Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Actionscript / July 2008



Tip: Looking for answers? Try searching our database.

A simple line codes, but it is just not working

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
seabw - 30 Jun 2008 16:18 GMT
Hi guys:

I am working on this Flash project, somehow this line of code is just not
working, I hope someone here may have an idea:
var nugget:Number = 3;
Controller.mc_art.mc_GM["mc_nugget"+(nugget+1)].gotoAndStop("hide");

However, if I replace the code above with the following code, it will work
fine as it should do:

Controller.mc_art.mc_GM.mc_nugget4.gotoAndStop("hide");

I have also done a bit debugging myself:

trace(Controller.mc_art.mc_GM.); ---------- positive, it is fine
trace(Controller.mc_art.mc_GM["mc_nugget"+(nugget+1)]); ----------- not
working, it displays "undefined"
Controller.mc_art.mc_GM["mc_nugget"+"4"].gotoAndStop("hide"); ---------- not
working...

Could someone help me please?

PS. I could always use switch or if else to make it work, but I still want to
know why this is happening
switch(nugget)
{
case 0: Controller.mc_art.mc_GM.mc_nugget0.gotoAndStop("hide");
case 1: Controller.mc_art.mc_GM.mc_nugget1.gotoAndStop("hide");
..........

}

But this is not efficient coding at all to me...
kglad - 30 Jun 2008 17:27 GMT
what's the following show:

trace(Controller.mc_art.mc_GM.mc_nugget4)
trace(Controller.mc_art.mc_GM["mc_nugget4"])
Ritesh@Ahmedabad - 01 Jul 2008 07:20 GMT
> what's the following show:
>
> trace(Controller.mc_art.mc_GM.mc_nugget4)
> trace(Controller.mc_art.mc_GM["mc_nugget4"])
Ritesh@Ahmedabad - 01 Jul 2008 07:20 GMT
Hi,

Simple Mistake

Try The below one

trace(Controller.mc_art.mc_GM["mc_nugget"+Math.Number(nugget+1)]);

Do Let me know if it works

Regards

Ritesh Newal
riteshnewal@hotmail.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.