in Education by
I have a project i need to update form AS2 to AS3 as i need some of the new functions available for vertical centering of text. My current AS2 code on the time line is as follows. var dataField = _root.dataField; var dataType = _root.dataType; var dataPage = _root.dataPage; var dataVar = _root.dataVar; _root.mc.onRelease = function() { getURL("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self"); }; And my external AS file is as follows. import mx.transitions.Tween; /** * * StandardKey is attached to a movieclip in the library. * It handles the basic button behavior of the keyboard keys. * When each button is placed on the stage, it's instance name * will be the unique ID of the key. * */ class StandardKey extends MovieClip { /////////////////////////////////////// //Stage Elements var highlight:MovieClip; //End Stage Elements var highlightTween:Tween; function StandardKey(Void) { //Repaint the key with 0 alpha highlight._alpha = 0; } function onPress(Void):Void { //Do the highlight animation highlightTween.stop(); highlightTween = new Tween(highlight, "_alpha", mx.transitions.easing.Regular.easeInOut, 100, 0, 10, false); } } Here is my attempt at moving timeline and external AS2 to AS3 Timeline i now have : var dataField = this.dataField; var dataType = this.dataType; var dataPage = this.dataPage; var dataVar = this.dataVar; var dataNum = this.dataNum; _root.mc.onRelease = function() { navigateToURL(new URLRequest("index.php?page="+dataPage+"&num="+dataNum+"&"+dataType+"="+dataVar, "_self")); }; External AS3 i have package { import fl.transitions.Tween; import fl.transitions.easing.*; import flash.display.MovieClip; /** * * StandardKey is attached to a movieclip in the library. * It handles the basic button behavior of the keyboard keys. * When each button is placed on the stage, it's instance name * will be the unique ID of the key. * */ public class StandardKey extends MovieClip { /////////////////////////////////////// //Stage Elements var highlight:MovieClip; //End Stage Elements var highlightTween:Tween; public function StandardKey(Void) { //Repaint the key with 0 alpha highlight._alpha = 0; } public function onPress(Void):void { //Do the highlight animation highlightTween.stop(); highlightTween = new Tween(highlight, "_alpha", fl.transitions.easing.Regular.easeInOut, 100, 0, 10, false); } } } The errors i am currently getting are : Scene 1, Layer 'Label', Frame 1, Line 6 1120: Access of undefined property _root. Scene 1, Layer 'Label', Frame 1, Line 7 1137: Incorrect number of arguments. Expected no more than 1. If any one could help me work this out i would appreciate it very much. Kind regards Mat. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Don't use _root, if you absolutely need to reference upwards, the closest AS3 equivalent is stage. DisplayObject properties no longer start with an underscore (_alpha vs. alpha in your case). You can't use onRelease, you need to use addEventListener() Your timeline code makes little, sense, why are you making local vars? All in all, I'd recommend you reading up on Adobe's migration guide.

Related questions

0 votes
    Ok, in hindsight this does seem to be a silly problem I got myself into and shouldn't have done ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    What are the major problems in using pumping for concreting works?...
asked Jan 20, 2021 in Technology by JackTerrance
0 votes
    I was wondering if you creative minds out there could think of some situations or applications in the web environment ... AI in games. Select the correct answer from above options...
asked Jan 26, 2022 in Education by JackTerrance
0 votes
    Ok here is the deal. I have to store a couple of images (tiff format) into a sql database.They ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    Sorry for the subject line sounding like an even nerdier Harry Potter title. I'm trying to use AS3' ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 16, 2022 in Education by JackTerrance
0 votes
    extension. (e) Flash saves a file with.fla extension and executes it with (i) .fla (ii) .swf (iii) Doc (iv) fsh Select the correct answer from above options...
asked Dec 1, 2021 in Education by JackTerrance
0 votes
    _____ is a small, portable flash memory card that plugs into a computer’s USB port and functions as a portable hard drive ? 1. Flash drive 2. CD-RW 3. DVD-ROM 4. CD-ROM...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    I am accessing custom UIComponent via SWC file from Flex 3. This component works OK in Flash CS3, but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    In a CakePHP 1.2 app, I'm using to output messages like "Record edited". It's working great. ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    Have you found such a tool and used it successfully? JavaScript questions and answers, JavaScript questions pdf ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Have you found such a tool and used it successfully? JavaScript questions and answers, JavaScript questions pdf ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Which storage type is used in the modern digital cameras, mobile phones, Mp3 players etc..? A) Pendrive B) ... drive D) Floppy drive Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
...