简体   繁体   中英

Passing variable to flash from php

I have a little problem..but im goin' to crazy...

In the html i have this code:

 <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  codebase="http://macromedia.com/cabs/swflash.cab#version=6,0,0,0"   
  ID=flaMovie WIDTH=554.6 HEIGHT=57.3>
  <PARAM NAME=movie VALUE="main_menu.swf">
  <PARAM NAME=FlashVars VALUE="nyelv=<?php echo $_SESSION['lang'];?>">
  <PARAM NAME=quality VALUE=medium>
  <PARAM NAME=bgcolor VALUE=#99CC33>
  <EMBED src="main_menu.swf" 
    FlashVars='nyelv=<?php echo $_SESSION['lang'];?>' 
    bgcolor=#99CC33 WIDTH=554.6 HEIGHT=57.3 
    TYPE="application/x-shockwave-flash">
  </EMBED>
</OBJECT>

And the flash this:

First keyframe:

 stop();
 if (lang == "EN") {
    gotoAndStop(2);
 }else{
    gotoAndStop(3);
 }

2,3 keyframe only has some graph, and Stop()

If lang is EN then i need to go keyframe 2, if not the go to 3....

On IE6 works well..no problem. On FF 3.5 something not ok.. if i hit the refresh button on FF, then sometimes OK, sometimes not OK, sometimes only a part of the graphic shown on keyframe 3...i dont really understand..

Earlier i have no problem with flasvars on FF...something changed with FF 3.x?

Any other way to pass variable to flash? (i dont want to use query string..)

Maybee jquery?

Thnx.

It looks to me like you are passing a variable called nyelv and not lang . Check your flashvars and try again.

As for the erroneous rendering in Firefox, that might be a cache issue. Are you making sure that everything is properly loaded before calling the gotoAndStop() ?

Also, if you're using Flash 8 or earlier, it might be a good idea to wait for a frame advance after everything is loaded. I've found that to help a lot of times, since everything being loaded does not guarantee that everything is also initialized.

So to give a proper answer, try this (assuming flash 8 or earlier, and AS2):

Frame 1:
--------

function preloadWait() :Void {
   if (_root.getBytesLoaded() != undefined 
        && _root.getBytesLoaded() == _root.getBytesTotal()) {
       delete _root.onEnterFrame;
       _root.play();
   }
}

stop();
_root.onEnterFrame == preloadWait;

Frame 2:
--------

if (lang == "EN") {
    gotoAndStop(3);
 }else{
    gotoAndStop(4);
 }

Frame 3 and 4 should contain what you now have in frames 2 and 3.

Yes. New flash player.. $_SESSION['lang'] output is EN or HUN depend on what link you pressed....if i hardcode the EN into flashvars then nothing changed, so $_SESSION['lang'] i think is ok...with good output...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM