Home  |  About  | Last |  Submit  |  Contact
AllQuests.com



Previous Question:  Sorry - INext Question:  Clickable image link  PHP
Question Eval replacement in AS3 ( kirupaForum Flash CS3 )
Updated: 2008-05-13 13:17:38 (10)
Eval replacement in AS3

Quote:
var currentPage="contentHome_mc";

contentHome_mc.gotoAndPlay("on");

//Functions
function animateOn(page:String) {
eval(page).gotoAndPlay("on");
}

function animateOff(page:String) {
eval(page).gotoAndPlay("off")
}

function onHomeclick(evt:MouseEvent) {
if (currentPage != "contentHome_mc") {
animateOff(currentPage);
animateOn("contentHome_mc");
currentPage="contentHome_mc";
}
}

function onAboutclick(MouseEvent) {
if (currentPage!= "contentAbout_mc") {
animateOff(currentPage);
animateOn("contentAbout_mc");
currentPage="contentAbout";
}
}

function onProductsclick(MouseEvent) {
if (currentPage!= "contentProducts_mc") {
animateOff(currentPage);
animateOn("contentProducts_mc");
currentPage="contentProducts";
}
}


//Menu Button actions
home_mc.addEventListener(MouseEvent.CLICK, onHomeclick);
products_mc.addEventListener(MouseEvent.CLICK, onProductsclick);
about_mc.addEventListener(MouseEvent.CLICK, onAboutclick);
hey guys can anyone help me out please ? i am watching the learnflash building a flash site with flash 8 video and i am trying to make the exact things but instead of actionscript 2 with AS3.so far i did great but now that the functions and variables started gettind involved for lots actions it seems that there are many dieferences....

what can i put instead of the "eval" so i can havce the same result as the eval ?????? everything else works just that. please tell me how to do it.....

if you didn't understand my problem is how can i make the variable of the function gets a value from the event listeners....and convert the string it gets to a code so to complete the function!

Answers: Eval replacement in AS3 ( kirupaForum Flash CS3 )
Eval replacement in AS3

you should use getChildByName (string). this will allow you to retrieve a child element of a particular DisplayObject (such as a MovieClip).

bigarth

Eval replacement in AS3

so you mean that in the place of eval i should put your code ? like this ?


Quote:
function animateOn(page:String) {
getChildByName (string)(page).gotoAndPlay("on");
}
edit: ok i found it...thanks man!!!!

is there any way to find out how to replace actionscript 2 to 3 ? like this situation ? cause i really need it !!!

lambros

Eval replacement in AS3

the (string) was just a reference for you. it would look like:

function animateOn (page:String) {
getChildByName (page).gotoAndPlay ("on");
}

bigarth

Eval replacement in AS3

yeah i figured that out after two experiments....you unsderstand that i am very noob yet

thanks again....

i 'd like to ask you is there any site any ebbok or video that i can use very time i have a script in AS2 and i want to make it AS3 ?? cause i have a complete tutorial on making a flash with preloaders popups forms everything but unfortunately it's for flash 8 and AS2. i try to mak every excample from there to as3 but it's pretty difficult when variables and functions are involved cause the structure is different...
so is thre any way to find how the AS2 is made to AS3 ??????

lambros

Eval replacement in AS3

not that i know of. i usually find out my information by google-ing "actionscript 3" and whatever term i'm looking to replace. for instance, for your original question i bet you could have found an answer by searching "actionscript 3 eval" (without quotes)

bigarth

Eval replacement in AS3

ok man thanks for the help

lambros

Eval replacement in AS3

Try this link http://livedocs.adobe.com/flex/2/langref/migration.html

Also: http://www.5etdemi.com/convert/

Dimitree

Eval replacement in AS3

hey dimitree thanks for the links but the first one is in the flash help too and it doesn't say what to put in AS3 instead of AS2.like eval it just says removed .....nothing else......

as for the second one i didn't understand how to use it ? is it just for classes ???????

lambros

Eval replacement in AS3

Quote:
Originally Posted by lambros
hey dimitree thanks for the links but the first one is in the flash help too and it doesn't say what to put in AS3 instead of AS2.like eval it just says removed .....nothing else......

as for the second one i didn't understand how to use it ? is it just for classes ???????
Yes it s only for classes.

Dimitree

Eval replacement in AS3

...and read senocular's AS3 Tip of the Day in the ActionScript 3 forum.

And remain calm when things don't work the way you want them to

dthought

Previous Question:  Sorry - INext Question:  Clickable image link  SitePoint Forums  PHP

- Source: Eval replacement in AS3 kirupaForum Flash CS3
- Previous Question: Sorry - I've sinned SitePoint Forums CSS
- Next Question: Clickable image link SitePoint Forums PHP