-
1. Re: Multiple instances of Movieclips working with AS3
kglad Jul 9, 2009 10:16 AM (in response to zm15)for(var i:uint = 1; i<=7; i++){
this["mc"+String(i)].addEventListener(MouseEvent.ROLL_OVER,rolloverF);
}function rolloverF(evt:MouseEvent):void {
this.addChild(MovieClip(evt.currentTarget));
} -
2. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 9, 2009 1:02 PM (in response to kglad)I am only able to get one of the mc's to work.
Here is the code using, all together on one layer of the main scene:
mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
mc.gotoAndStop(2);}
mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);
function outHandler(evt:MouseEvent):void {
mc.gotoAndStop(1);}
for(var i:uint = 1; i<=2; i++){
this["mc"+String(i)].addEventListener(MouseEvent.ROLL_OVER,rolloverF);
}function rolloverF(evt:MouseEvent):void {
this.addChild(MovieClip(evt.currentTarget));
}Here is a link to the file in progress. the top 'property information' and the 'map it' button are the 2 active mc's
http://www.landmarkmg.com/beta/project_4.html
I have the property information mc named 'mc' and the map it mc named 'mc1'
-
3. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 10, 2009 6:29 AM (in response to kglad).
-
4. Re: Multiple instances of Movieclips working with AS3
kglad Jul 10, 2009 6:48 AM (in response to zm15)property information works. i don't see mapit doing anything.
what's the problem?
-
5. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 10, 2009 7:01 AM (in response to kglad)'map it' should have a box that pops out when hovered over, but it's not. The movieclip that is named 'mc' is the only one that works. The top 'property information' has the instance name 'mc' and Map It has the instance name of 'mc1' Map It should have a movie clip that plays when you hover over it.
-
6. Re: Multiple instances of Movieclips working with AS3
kglad Jul 10, 2009 7:10 AM (in response to zm15)did you code for that to happen?
-
7. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 10, 2009 7:12 AM (in response to kglad)I thought i did with this code here:
mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
mc.gotoAndStop(2);}
mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);
function outHandler(evt:MouseEvent):void {
mc.gotoAndStop(1);}
for(var i:uint = 1; i<=2; i++){
this["mc"+String(i)].addEventListener(MouseEvent.ROLL_OVER,rolloverF);
}function rolloverF(evt:MouseEvent):void {
this.addChild(MovieClip(evt.currentTarget));
} -
8. Re: Multiple instances of Movieclips working with AS3
kglad Jul 10, 2009 7:49 AM (in response to zm15)the only thing occuring in mc1,mc2 rollovers is they move to the top (z-order) in the parent's display list.
-
9. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 10, 2009 8:05 AM (in response to kglad)hmm, this code was converted from AS2 to AS3 to allow the mc that is hovered over to stay active while the selection area has the mouse over it, i.e. the Property Information tab
mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
function overHandler(evt:MouseEvent):void {
mc.gotoAndStop(2);}
mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);
function outHandler(evt:MouseEvent):void {
mc.gotoAndStop(1);}So i don't need that second set of code that allow the active mc to be on top. Trying to allow multiple mc's to be used that can be hovered over like the 'property information' tab and stay active while the mouse is over the expanded area.
I tried adding the above code twice, i.e. for mc1, mc2, etc... And got duplicate code errors.
-
10. Re: Multiple instances of Movieclips working with AS3
zm15 Jul 10, 2009 11:19 AM (in response to kglad).
-
11. Re: Multiple instances of Movieclips working with AS3
kglad Jul 10, 2009 1:19 PM (in response to zm15)you can't have functions with the same names.


