Thanks Paul,
Sorry for forgetting the subject line. Won't happen again ;-)
You're right about the Object as an Array I guess I can just create
an associative array instead of an object, althoug Moock states that
both approaches are common practice.
I solved (or rather circumvented) my problem by comparing the names
of myObj and the item clicked
Your idea was nice, but it didn't solve my problem.
Maybe I wasn't clear enough, but I have a lot of 'myArray''s and I
need to know which property 'select' to set when clicking an item ->
the 'select' that is in the same array as the item clicked on.
The theoretical problem remains: myArray knows it contains item1 but
does item1 have a way of knowing it is part of myArray?
thanks
Willem van den Goorbergh
On 26-feb-2010, at 18:39, Paul Andrews wrote:
Geografiek wrote:
Hi list,
Suppose I have an associative array like this:
var myArray:Object = new Object();
myArray.item1 = item1;
myArray.item2 = item2;
myArray.selected = false;
var myObj:Object = new Object();
myObj.itemGroup=[];
myObj.itemGroup.push( item1);
myObj.itemGroup.push( item2);
myObj.selected = false;
item1.addEventListener(MouseEvent.CLICK, onClick);
item2.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:Event):void {
for (var idx:uint=0; idx<myObj.length; idx++){
if (myobj.selected){
myObj.itemGroup[idx].alpha=1;
} else {
myObj.itemGroup[idx].alpha=1;
}
}
I don't like calling objects Arrays, though I understand your usage..
What happened to the subject line.. ?
Paul
item1 and item2 are 2 mc's living on the stage. Selected is a
newly created property on myArray.
Now I want to change myArray.selected by clicking on one of both
item and change the appearance of both items based on the value of
myArray.selected. Is this possible?
In other words: myArray knows it contains item1 but does item1
have a way of knowing it is part of myArray.
Thanks,
Willem van den Goorbergh
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)
30-2719512 or cell phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)
30-2719512 or cell phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders