A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: FlashVars

  1. #1
    Odisey Odisey's Avatar
    Join Date
    Apr 2004
    Location
    WV
    Posts
    213

    FlashVars

    FlashVars

    Can anyone give a scenario that FlashVars is useful in?
    I am learning the action scripting _lingGauge:E and I am uncertain of the usefulness of FlashVars.

    THX
    ODC
    Much to learn.... Much to learn....

  2. #2
    Senior Member
    Join Date
    May 2002
    Posts
    1,017
    Hmm, there are as many scenarios as many reasons you would have to pass information to a flash movie at loading. For example a session variable, or cookie information, or path to image to load, or path to a text file, or text to display, or the title of the section of your website, so it shows the appropriate picture and so on and so on...
    while (2+2 == 4) {
    drink ("bourbon");
    }
    gotoAndStop("bed");

  3. #3
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Usually I use it to pass variables from the url into flash.

    For example, on a multilanguage site:
    Code:
    www.mysite.com/index.php?lang=pt
    // or
    www.mysite.com/index.php?lang=en
    you'd pass lang=pt or lang=en into flash.

  4. #4
    Odisey Odisey's Avatar
    Join Date
    Apr 2004
    Location
    WV
    Posts
    213
    I just beginning to learn AS. Reading the AS files in help 8.0. It made absolutely no sense until I learned all the definitions, jargon, etc... 1/2 trough I think I can CNP with more confidence -- I know some structure now...

    So...

    The multi-language I can use--need to figure that out--I speak a few languages and have a need for that, the cookie sessions I need to learn--"why" I don't know yet, sound like something useful. The other purposes: would you not put images and text files, etc... 'in' the movie, or call them from in the movie? I don't quite understand why you would call an image to load for example, when you probaly have more than one in the movie, and they should load up with no troubles if the movie is designed right...

    ODC
    Much to learn.... Much to learn....

  5. #5
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    I searched for FlashVars and nunomira and was able to find other examples:
    - send the playhead to a specific frame
    - pass a link into flash

  6. #6
    Senior Member
    Join Date
    May 2002
    Posts
    1,017
    Imagine this. You have a flash banner incorporated in 5 html pages on your site. You would like that on each page it shows a different picture and text. Would you make 5 different banners? You could make just one with a dynamic textfield and an empty container movie which is going to load an image from the server. So on each page you load the same flash movie passing different variables to the movie - text and path to the image. Of course you could put all the 5 images and texts inside the movie yet then each time you want to update a text or a picture you have to update the whole flash movie and even then you still would need to pass the title of the page to flash so it displays the correct picture and text.
    while (2+2 == 4) {
    drink ("bourbon");
    }
    gotoAndStop("bed");

  7. #7
    Odisey Odisey's Avatar
    Join Date
    Apr 2004
    Location
    WV
    Posts
    213

    FlashVar

    SmileV

    Hello.... OK... I am understanding the superclasses, classes, methods, variables, parameters, interfaces, etc.... It is making much more sense.

    I been thinking about the FlashVar concept and its usefullness. I'm realizing--well I knew--there are many ways to accomplish something in Flash and it probably amounts to programmer's personal preferences and following best practices.

    So.. I saw thie FlashVar in the help files .... learning AS 2.0 The files I read place the FlashVar in the HTLM page that embeds teh SWF file. One needs add a Parma field and extend the embed movie tag. YOu know this already--I think.

    What you explained about the banner. I can do this with dynamic text fields and image files easily....I know how to do this since F5. I thought about redoing a photography site which allowed me to update pics simply by overwriting a directory of old images with new ones -- web site update complete with one click. The dynamic text -- I need to learn how to format it yet... I think in F8 HTML can be used or embedded, and if that's true one can do much more with text using that appraoch...

    So is the FlashVar as I described with the pics here. Or is it when you first load your site and it grabs files on the server? Or both...?

    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="urlImages" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="urlImages.swf" />
    <param name="FlashVars" value="imgURL=http://www.helpexamples.com/flash/images/image2.jpg">
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="urlImages.swf" quality="high" FlashVars="imgURL=http://www.helpexamples.com/flash/images/image2.jpg" bgcolor="#ffffff" width="550" height="400" name="urlImages" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
    </body>

    ODC
    Last edited by Odisey; 02-26-2006 at 10:36 PM. Reason: Had a thought
    Much to learn.... Much to learn....

  8. #8
    Senior Member
    Join Date
    May 2002
    Posts
    1,017
    Well FLashVars is used to pass variables from html (php, javascript whatever) when the flash movie is being loaded. It's like a query string. When the flash is loaded all the variables are already there at the _root. I cant explain it any better than this. The uses? Too many like I already said
    while (2+2 == 4) {
    drink ("bourbon");
    }
    gotoAndStop("bed");

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center