Skip to main content
Participating Frequently
November 7, 2006
Answered

Left side of assignment operator must be variable or property

  • November 7, 2006
  • 4 replies
  • 1469 views

I Need Help!!!
How do I prevent getting the message "Left side of assignment operator must be variable or property."

Im trying to use 'onRelease' on the instance named "Item1"
I have a variable named "sRange"

sRange+Item1.onRelease=function(){
This topic has been closed for replies.
Correct answer kglad
there doesn't appear to be any relationship between your attached movieclips and that onRelease handler. is there supposed to be one?

from your first post if sRange is a variable pointing to a movieclip that has a child movieclip with instance name item1, it appears you should use:

4 replies

kglad
Community Expert
Community Expert
November 9, 2006
you're welcome.
kglad
Community Expert
Community Expert
November 9, 2006
then it's the use of "this" that's causing the problem. you need to reference the timeline on which sRange is defined. when you use "this" in LVinfo.onLoad, "this" refers to LVinfo and sRange is NOT an object of LVinfo.
Participating Frequently
November 9, 2006
I C... but Im not sure what to do?

//this is the LoadVars that Im using:

var LVInfo:LoadVars=new LoadVars();
LVInfo.load(sRange+"/ProdInfo.txt");
LVInfo.onLoad=function(){
Custom.RangeInfo.text=this.RangeInfo; //how would I use the variable in place of custom
}
Participating Frequently
November 9, 2006
THANX I sat and thought about what you said...

I used

_root[sRange]. blah blah blah

that worked
kglad
Community Expert
Community Expert
November 8, 2006
do you have textfield in Special that has instance name RangeInfo?

in the directory that contains your swf/html do you have a folder named Special and in that directory have a file named ProdInfo.text and in that text file do you have something like:

RangeInfo=blah blah blah??
Participating Frequently
November 9, 2006
Yes there is.

If I write the value of the variable it will work

Custom.RangeInfo.text=this.RangeInfo;
November 7, 2006
this[sRange+"Item1"].onRelease=function(){ ...
sRange["Item1"].onRelease=function(){ ...
sRange.Item1.onRelease=function(){ ...

What you want to do with the variable sRange? It's the mc parent?

Participating Frequently
November 8, 2006
I still cant get it to work

what Im trying to do is...
Ive got a movie clip in my library named "mcProducts" which has a heap of nested clips which will be used as buttons.

var sRange:String;

this.attachMovie("mcProducts","Zodiac",1);
this.attachMovie("mcProducts","GTop",2);
this.attachMovie("mcProducts","Triple",3);
this.attachMovie("mcProducts","Custom",4);
this.attachMovie("mcProducts","Special",5);

sRange+".Item1".onRelease=function(){
trace(sRange +" Item1 Selected");
}

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
November 8, 2006
there doesn't appear to be any relationship between your attached movieclips and that onRelease handler. is there supposed to be one?

from your first post if sRange is a variable pointing to a movieclip that has a child movieclip with instance name item1, it appears you should use: