Zensai
08-01-2008, 03:47 PM
I'm a first time poster, and new user to Flash. I've been focusing on learning AS3, and using some of the external scripts like TweenMax, and some of the components for transitions.
One of the things I can't figure out how to do is from my main timeline execute a function that I built inside of a embedded MovieClip...
Example would be I create a menu_mc. And I build a init function inside of it. I would like to on the main timeline run it my init script. What I have been trying to do is trying to run menu_mc.init(); but it throws
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at afg_site_fla::contentHome_mc_3/init()
at afg_site_fla::MainTimeline/afg_site_fla::frame1()
Here is the code that is in my embedded MovieClip
import com.jumpeye.Events.TXEFFEvents;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
var txtFx_homeTitle:TXEFF = new TXEFF();
var txtFx_homeBody:TXEFF = new TXEFF();
function init():void {
this.addChild(txtFx_homeTitle);
this.addChild(txtFx_homeBody);
contentHomeTitle_dt.alpha = 0;
contentHomeBody_dt.alpha = 0;
//homeTitle Settings
txtFx_homeTitle.tweenDuration = 3;
txtFx_homeTitle.patternName = "Blur";
//homeBody Settings
txtFx_homeBody.patternName = "XYScale";
txtFx_homeBody.preset = 1;
txtFx_homeBody.customParam1 = 0;
txtFx_homeBody.customParam2 = 0;
txtFx_homeBody.customParam3 = 1;
txtFx_homeBody.customParam4 = 1;
txtFx_homeBody.customParam5 = 0;
txtFx_homeBody.customParam6 = 0;
txtFx_homeBody.tweenType = "Regular";
txtFx_homeBody.easeType = "easeOut";
txtFx_homeBody.tweenDuration = 2;
txtFx_homeBody.partialGroup = "letters";
txtFx_homeBody.partialPercent = 100;
txtFx_homeBody.selectedStrings = "";
txtFx_homeBody.blurAmount = 0;
txtFx_homeBody.partialStart = 50;
contentHomeTitle();
}
function contentHomeTitle() {
txtFx_homeTitle.target = contentHomeTitle_dt;
txtFx_homeTitle.addEventListener(TXEFFEvents.TRANS ITION_END, contentHomeBody);
}
function contentHomeBody(evtObj:TXEFFEvents):void {
txtFx_homeBody.target = contentHomeBody_dt;
txtFx_homeTitle.removeEventListener(TXEFFEvents.TR ANSITION_END, contentHomeBody);
}
Basically I just want to know how from the main timeline run functions that I build inside of my embedded MovieClips :)
Thanks
One of the things I can't figure out how to do is from my main timeline execute a function that I built inside of a embedded MovieClip...
Example would be I create a menu_mc. And I build a init function inside of it. I would like to on the main timeline run it my init script. What I have been trying to do is trying to run menu_mc.init(); but it throws
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at afg_site_fla::contentHome_mc_3/init()
at afg_site_fla::MainTimeline/afg_site_fla::frame1()
Here is the code that is in my embedded MovieClip
import com.jumpeye.Events.TXEFFEvents;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
var txtFx_homeTitle:TXEFF = new TXEFF();
var txtFx_homeBody:TXEFF = new TXEFF();
function init():void {
this.addChild(txtFx_homeTitle);
this.addChild(txtFx_homeBody);
contentHomeTitle_dt.alpha = 0;
contentHomeBody_dt.alpha = 0;
//homeTitle Settings
txtFx_homeTitle.tweenDuration = 3;
txtFx_homeTitle.patternName = "Blur";
//homeBody Settings
txtFx_homeBody.patternName = "XYScale";
txtFx_homeBody.preset = 1;
txtFx_homeBody.customParam1 = 0;
txtFx_homeBody.customParam2 = 0;
txtFx_homeBody.customParam3 = 1;
txtFx_homeBody.customParam4 = 1;
txtFx_homeBody.customParam5 = 0;
txtFx_homeBody.customParam6 = 0;
txtFx_homeBody.tweenType = "Regular";
txtFx_homeBody.easeType = "easeOut";
txtFx_homeBody.tweenDuration = 2;
txtFx_homeBody.partialGroup = "letters";
txtFx_homeBody.partialPercent = 100;
txtFx_homeBody.selectedStrings = "";
txtFx_homeBody.blurAmount = 0;
txtFx_homeBody.partialStart = 50;
contentHomeTitle();
}
function contentHomeTitle() {
txtFx_homeTitle.target = contentHomeTitle_dt;
txtFx_homeTitle.addEventListener(TXEFFEvents.TRANS ITION_END, contentHomeBody);
}
function contentHomeBody(evtObj:TXEFFEvents):void {
txtFx_homeBody.target = contentHomeBody_dt;
txtFx_homeTitle.removeEventListener(TXEFFEvents.TR ANSITION_END, contentHomeBody);
}
Basically I just want to know how from the main timeline run functions that I build inside of my embedded MovieClips :)
Thanks