View Single Post

  #3 (permalink)  
Old 26-07-08, 10:50
coma coma is offline
Junior Member
 
Join Date: Jul 2008
Posts: 8
Rep Power: 0
coma is on a distinguished road
Re: variables and functions from child movieclip

okay well its a bit hard to show the actual code (cause its long and messy) so ive made this small and simple fla file (Attached) to better demonstrate my need.

on the main timeline, in the "AS Root" Layer:
Code:
var String1:String="Hello ";
var String2:String="World!";
 
function OutPut():void{
    trace (String1+String2);
}
 
OutPut();
in the Movieclip HomeContent in the "AS Home" Layer:
Code:
btnOutPut.addEventListener(MouseEvent.MOUSE_DOWN, LetSee);
function LetSee(evt:Event):void{
 String1="Welcome "; // A variable declared on the main timeline, AS Root layer frame1
 String2="Stranger"; // A variable declared on the main timeline, AS Root layer frame1
 OutPut(); // A function declared on the main timeline, AS Root layer frame1
}
/*---------------------Error Messages---------------------
1120: Access of undefined property String1.
1120: Access of undefined property String2.
1180: Call to a possibly undefined method OutPut.
--------------------------------------------------------------*/
Attached Files
File Type: fla Global.fla (64.0 KB, 11 views)

Reply With Quote