dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flash Parameters Help

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    3

    Flash Parameters Help

    I am new to flash parameters but from the research I could find so far it seems that this should be fairly simple. I can't seem to get my head around it.

    I have a flash file that has a movie clip in it. In this movie clip there are two movie clips. What I need to do is show a one movie clip and hide another. I basically only need help with setting up the reading of the flash parameter code in flash...

    Code:

    Code:
    var imageToShow:String;
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    This is basically what I have... I'm not sure what to go on to next or if this is even correct. I basically need to get to the point where I can say...

    Code:

    Code:

    Code:
    if (parameter == "image1") {
     image.image1.alpha = 1;
     image.image2.alpha = 0;
    }
    Or something to that effect. Sorry I'm a bit new to this and none of the tutorials I have seen explain this well enough for me to understand.

    Thanks!

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Flashvars sends parameters in name/value pairs. You'll need a key to look for, such as "imageToshow", which you can assign the value "image1" if you want.

    Your code to get the parameters object is correct. Once you have that paramObj, you need to look for your key in it.
    Code:
    if (paramObj["imageToShow"] == "image1"){
      //..do stuff
    }
    You'll set these parameters as a flashvars value. If you're using swfobject, you can pass a javascript object with the keys and values. Otherwise, you'll need to set the flashVars attribute on the object or embed like so:
    Code:
    flashVars="imageToShow=image1"
    If you had more variables to pass, you'd separate them with ampersands:
    Code:
    flashVars="imageToShow=image1&somekey=someval"

  3. #3
    Junior Member
    Join Date
    Jun 2007
    Posts
    3
    This is exactly what I needed explained perfectly. Thanks you very much you're a life saver. (You should write tutorials)

    Thanks again!

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