-
change dynamic text located inside MC1 from MC2
hello guys, i encountered a problem scripting in as 3.0
i created a dynamic text field inside a movie clip, for example movieclip1_mc->movieclipInner1_mc->textfield1_textfield, loading a text from file(.txt). The thing is when I click a button located inside movieclip2_mc->movieclipInner2_mc->BTN_btn, that text variable initial loaded, to change.
I can't get a reference to that textfield1_textfield by scripting inside movieclipInner2_mc, if you guys can give me a tip i would be forever grateful.
I have to mention that I am kinda noob.
i tried with linkage and parent but no success, i bet i don't know how to use them properly. please help.
-
pls help guyz it's quite urgent.
-
Senior Member
What script are you using to get the textfield?
- The right of the People to create Flash movies shall not be infringed. -
-
var maintextload:URLLoader = new URLLoader();
var aditionaltextload:URLLoader = new URLLoader();
//var _parent:MovieClip=this.parent as MovieClip;
//trace (_parent);
// telling the loader that we are dealing with variables here.
maintextload.dataFormat = URLLoaderDataFormat.VARIABLES;
aditionaltextload.dataFormat = URLLoaderDataFormat.VARIABLES;
/*listen for the even called COMPLETE which means it will activate
a function called "loading" when our flash movie has completed.*/
maintextload.addEventListener(Event.COMPLETE, maintextloading);
aditionaltextload.addEventListener(Event.COMPLETE, aditionaltextloading);
// Here we tell our loading which file to extract from.
maintextload.load(new URLRequest("http:"));
aditionaltextload.load(new URLRequest("http:"));
// This is the function that will happen when the eventlistener activates.
// basiclly it says that our text fields called content_1 and _2's text property
// should be equal to loader.data.var_1 and var_2 (as you might remember from the explanation above).
function maintextloading (event:Event):void {
maintext.text = maintextload.data.homeText
TitleText.text = maintextload.data.welcomeText
}
function aditionaltextloading (event:Event):void {
aditionaltext.text = aditionaltextload.data.aditionalText
aditionalTitle.text = aditionaltextload.data.aditionalTitle
}
I use this script to load text into the textfield.
to make a reference to the text field i simply use it's instance name in other movieclips, i don't know how to script to get to it.
Last edited by dementhor; 07-24-2008 at 07:36 AM.
-
Senior Member
You have to use paths. Something like this:
var mcc:MovieClip=MovieClip(parent.parent.getChildByNa me("mc1")).getChildByName("mc2") as MovieClip;
trace(mcc.mct.text);
- The right of the People to create Flash movies shall not be infringed. -
-
thank you so much, it works perfectly. thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|