Topic: using flashVars to access current image info from javascript
Hi, I want to access the path of the current image from javascript. I have tried a couple of methods but the method that seems would be easiest would be to:
- add a flashvar called curImage,
- update the value of this variable within image.as class on image load
- in my HTML I could read the flashVar at any time using getVariable.
Here is what I did:
In my HTML I added
fo.addVariable("curImage", "grue");
In the image.as class I added a line to set the value of this variable to 'foo'
public function loadImage(loadNextonDone:Boolean){
mLoadNextonDone = loadNextonDone;
//start loading image
mLoader_mcl = new MovieClipLoader();
mLoader_mcl.addListener(this);
mLoader_mcl.loadClip(mImageURL,mLoader_mc);
_root.curImage='foo'; // <<<<--------
mLoader_mc._visible = false;
resizeImage();//center loader
}
When I run this function I always get grue and not foo like I would expect.
function whatImage(){
alert(fo.getVariable("curImage",true));
}
What gives?
All ideas welcome, thx.