Skip to main content
Participant
September 28, 2008
Question

Pass parameters to a movieclip

  • September 28, 2008
  • 2 replies
  • 276 views
I call new movie clip with

initObj = new Object()
initObj.recording = recording;
initObj.motionDetection = motionDetection;
initObj.timeRecord = timeRecord;
_root.attachMovie("recordWindow","recordWindow_mc",_root.getNextHighestDepth(),{_x: 0, _y: 0}, initObj);

Now in the code for the recordWindow movieclip I want to get the values I passed via initObj.

Do I need an onLoad function? Would it contain these lines of code to get the parameter values passed to the movieclip?
var motionDetection:Boolean = initObj.motionDetection;
var timeRecord:Boolean = initObj.timeRecord;
var recording:Boolean = initObj.recording;

Yours,
David
This topic has been closed for replies.

2 replies

Inspiring
September 29, 2008
You do as kglad said, or simply incorporate the three variables into the
attach:

_root.attachMovie("recordWindow","recordWindow_mc",_root.getNextHighestDepth(),
{_x: 0, _y: 0, recording:recording, motionDection:motionDetection,
timeRecord:timeRecord});


--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


kglad
Community Expert
Community Expert
September 28, 2008
attachMovie() only accepts, a max, of 4 parameters. remove the 2nd to last parameter and incorporate those values into initObj.

p.s. make sure recording, motionDetection and timeRecord are defined.