Link to home
Start Free TrialLog in
Avatar of bLUE
bLUE

asked on

Referencing problem !

Hello.

On my clip (which is called objHover) I have the following code:

onClipEvent(data)
{
      strName = Name;
}

onClipEvent(load)
{
      loadVariables ("testinfo.html", this);
}


And this works fine. The field called strName gets populated.
But when I try and move it into my main action layer, it stops working. Here is my code:

objHover.onData = function () {
      strName = Name;
}

objHover.onLoad = function () {
      loadVariables("testinfo.html", objHover);
}

Could someone please tell me what is wrong there? Any help would be greatly appreciated. Thanks.
Avatar of Aneesh Chopra
Aneesh Chopra
Flag of India image

onClipEvent(data) and onClipEvent(load) can't be written as you are trying here...

only "MovieClip.onEnterFrame" is supported outside MovieClip...

alternative to ur code, you can simply assign variables as following:
----------
objHover.strName = Name;
objHover.loadVariables("testinfo.html", objHover);
---------

-Aneesh
Avatar of bLUE
bLUE

ASKER

Hey Aneesh.

Thanks for your response. I tried that but it didnt work? Any ideas? I put the code into my main action layer.
Avatar of bLUE

ASKER

I think this works:

myVars = new LoadVars();
myVars.load("testinfo.html");


myVars.onLoad = function (success) {
     if (success) {
        trace (" variables loaded ");
        trace(myVars.Name);
    } else {
        trace (" Error loading variables ");
    }
}
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial