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&#40;&#41;;//center loader
    &#125;

When I run this function I always get grue and not foo like I would expect. 

   function whatImage&#40;&#41;&#123;
            alert&#40;fo.getVariable&#40;"curImage",true&#41;&#41;;
        &#125;

What gives?

All ideas welcome, thx.

Re: using flashVars to access current image info from javascript

This is getting intensely frustrating.

I am trying another method that all the docs say should work but it doesn't and I get zero feedback from flash telling me whats going on.

I am trying this now.
In the image.as class I am adding

import flash.external.*;

and then calling 
   

ExternalInterface.call&#40;"whatImage"&#41;;

the javascript function on my page is simply:

    function whatImage&#40;&#41;&#123;
            alert&#40;'foo'&#41;;
        &#125;

I save image.as, publish the viewer, refresh the page. the viewer loads and the images load but I get nothing.  I would be nice to get an error telling me what the heck isn't working but I get nada.

I just want this one simple functionality and I have wasted a whole day on it. Doesn't anyone have any ideas?

Re: using flashVars to access current image info from javascript

Apparently running locally was the problem.  Using the external interface works fine when running on my web server.

Cheers
Dave

Feature suggestion:
Add call back functions that can be called from javascript to return properties of the currently selected image.

Cheers