Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorbartleB
    • CommentTimeDec 2nd 2007
     
    I could really use some help with this....

    I have created a banner.swf file and placed it on an html page using swfObject js detection. I want to send a variable from the web page to tell the banner.swf file to load an external image and/or .swf file to an empty_mc on the stage with instance name "container".


    I have the following on the html:


    <script type="text/javascript"> var fo = new FlashObject("banner.swf", "swf", "800", "212", "8", "#ffffff"); fo.write("movieAlt");
    so.addVariable("var1", "myImage1.jpg");
    so.write("flashcontent");</script>



    I have the following on the frame 1 Actionscript:


    var myMCL:MovieClipLoader = new MovieClipLoader();
    myMCL.loadClip("var1", "container");


    I have gotten the external file to load when it's hard coded into the actionscript but need to load it from html page. I know I must be missing something so thanks for any help! BB
    • CommentAuthorAran
    • CommentTimeDec 2nd 2007
     
    var1 is a variable, not a string, so instead of:

    myMCL.loadClip("var1", "container");

    you want

    myMCL.loadClip(var1, "container");

    all variables passed into flash from swfobject are placed on the _root timeline. So make sure you are targetting the variable there.

    Also - you have some bad code in your swfobject definition - get rid of the line fo.write("movieAlt");
    • CommentAuthorbartleB
    • CommentTimeDec 3rd 2007
     
    I have eliminated the quotes from var1 in actionscript, however, myImage1.jpg is still not loading. The banner.swf is loading on the web page and all hard coded AS is working properly. The "container" mc is on the _root timeline: Movie Clip: Target="_level0.container"

    Flash frame 1 =:

    var myMCL:MovieClipLoader = new MovieClipLoader();
    myMCL.loadClip(var1, "container");

    is there any further actionscript required to load flashVars sent from the swfObject?

    Do I need to include _root or this?

    Thanks BB
    • CommentAuthorbartleB
    • CommentTimeDec 3rd 2007
     
    Aran,

    works like a charm, had the js vars mixed up should be:


    <script type="text/javascript"> var so = new FlashObject("banner.swf", "swf", "800", "212", "8", "#f2f3b4"); so.write("flashcontent");
    so.addVariable("var1", "myImage1.jpg");
    </script>

    Thanks for your help, really like this script...

    BB
    • CommentAuthorphilip
    • CommentTimeDec 4th 2007 edited
     
    hey BB

    just a head's up... your code still needs a minor tweak: "so.write" should be the last line.

    this

    <script type="text/javascript">
    var so = new FlashObject("banner.swf", "swf", "800", "212", "8", "#f2f3b4");
    so.write("flashcontent");
    so.addVariable("var1", "myImage1.jpg");
    </script>


    should be this

    <script type="text/javascript">
    var so = new FlashObject("banner.swf", "swf", "800", "212", "8", "#f2f3b4");
    so.addVariable("var1", "myImage1.jpg");
    so.write("flashcontent");
    </script>


    - philip