A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Trouble passing variables to flash using query string

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    12

    Trouble passing variables to flash using query string

    Okay I am trying to pass the variable myMOV to my flash using the following additions in my object tag:

    Code:
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="900" height="582" title="Definitive Home Theater">
           <param name="movie" value="main.swf?myMOV=music" />
           <param name="quality" value="high" />
           <param name="wmode" value="transparent" />
           <embed src="main.swf?myMOV=music" width="900" height="582" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"></embed>
         </object>
    In my flash file I have the following code:

    Code:
    if (_level0.myMOV == undefined) {
        gotoAndPlay("hcontrol");
    } else {
        gotoAndPlay("_level0.myMOV");
      
    }
    I want flash to gotoandplay the label "music" but it seems I am not passing the variable correctly. Anyone see what I am doing wrong?

  2. #2
    Junior Member
    Join Date
    Oct 2009
    Posts
    12
    I should also make note that the flash file that is trying to access the variable is being loaded into a blank mov clip in the main.swf.

  3. #3
    Junior Member
    Join Date
    Oct 2009
    Posts
    12
    I tried changing _level0 to _root but that didn't help. Do you guys see that I am doing anything obviously dumb.

  4. #4
    Member
    Join Date
    Mar 2006
    Posts
    41
    I'm not sure you can use that kind of query with AS2. Every time I've passed variables into an AS2 swf it has been with the flashvars parameter.

    Code:
    <param name="flashvars" value="myMOV=music" />

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    No it works (use a variable on _root with name myMOV, it does print)
    Bruceleeroy, remove the quotes:

    gotoAndPlay(_level0.myMOV);

    gparis

  6. #6
    Junior Member
    Join Date
    Oct 2009
    Posts
    12
    You guys are awesome let me give this a shot.

  7. #7
    Junior Member
    Join Date
    Oct 2009
    Posts
    12
    It Worked!!
    Thank you so much guys I was completely stumped.

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