Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-13-2005, 04:17 PM   #1
Registered User
Join Date: Jan 2005
Posts: 11
Default Dynamic Movieclips and movieclip properties

Hey all,

I'm having difficulty dynamically adding a movie clip to my movie. I have a main movie clip, and on the release of a button, it should add another movie clip from the library into the main movie clip. And technically, it does, but only for a split second, and then the imported movie clip disappears. I just realized that this happens for any action i have my button influence in any other movie clip. For example, when i change the dynamic text field's text property in a different movie clip, it only works for a second, even if i have a
ActionScript Code:
on the actions layer in the movieclip. Here's the code on my actions layer:

ActionScript Code:
wearIt_btn.onRelease = function() {       main_mc.attachMovie("att1", "newName1", 1); }

I copied almost directly off of the tutorial here for attachMovie (number 28), and the FLA provided works fine. Is it because i'm using actionScript 2?

And while i'm on the subject of movieclips, it is possible to add my own properties to a movieclip, right? For instance, a url to a jpeg image to be loaded in, probably from an XML document? Once i get the darned thing loaded, i need to be switching its contents dynamically.

Thanks for the help in advance .

Last edited by Jmc8385; 05-13-2005 at 04:30 PM.
Jmc8385 is offline   Reply With Quote
Old 05-13-2005, 05:27 PM   #2
Join Date: Jun 2001
Location: portland, or
Posts: 8,106

you will need some sort of counter..., so each time you add a mc, it gets attached at a new depth... your code currently attaches it on 1. also you want to generate a unique name for each mc attached, currently they are all called 'newName1'.

so try something like:
ActionScript Code:
var count=0; wearIt_btn.onRelease = function() {      main_mc.attachMovie("att1", "newName"+count, count);      count++;//increments count for the next movieclip to attach. }
what the hell was i thinking?
tg is offline   Reply With Quote
Old 05-13-2005, 06:00 PM   #3
Registered User
Join Date: Jan 2005
Posts: 11

I tried what you gave me, but it didn't work.

At the moment i'm only attaching one movieclip with a unique name. Each internal mc that i'll be putting into the main movieclip has only one frame. The problem is that after i release the button, the internal movie clip is attached to the main movie clip and it appears... but only for a second.

Your suggestion seems to be based around whether or not i'm loading different movieclips into a single main movieclip, which i'm not doing. (of course, i could be misunderstanding). Maybe i'm misunderstanding what depths are, would you mind explaining them?
Jmc8385 is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 06:51 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.