-
multiple jpgs/dynamic movieClips
Hello,
Here is my problem. In MX 2004, I am trying to load more than one jpg onto the stage at once using dynamically created dragable movieCips. I have a btn for each image, but when I select a btn, the other MC will disappear that was on the stage. I would like for the images to stage on while I select other btns.
Here is the code I have so far in the first frame.
this.createEmptyMovieClip("outer_mc",1); // create one empty movie clip
this.outer_mc.createEmptyMovieClip("inner_mc",1);
addPicture_btn.onPress = function() {
var newDepth = outer_mc.getNextHighestDepth(1); // puts new MC on next higher level
outer_mc.inner_mc.loadMovie("001.jpg", newDepth); // loads jpg into inner MC
outer_mc._x = 210;
outer_mc._y = 220;
}
outer_mc.onPress = function(){
this.startDrag();
}
outer_mc.onRelease = function(){
this.stopDrag();
}
this.createEmptyMovieClip("outer_mc2",10); // create one empty movie clip
this.outer_mc.createEmptyMovieClip("inner_mc2",10) ;
addPicture2_btn.onPress = function() {
var newDepth = outer_mc.getNextHighestDepth(10); // puts new MC on next higher level
outer_mc2.inner_mc2.loadMovie("002.jpg", newDepth); // loads jpg into inner MC
outer_mc2._x = -210;
outer_mc2._y = -20;
}
outer_mc2.onPress = function(){
this.startDrag();
}
outer_mc2.onRelease = function(){
this.stopDrag();
}
Can someone help me out?
Thanks,
xcaliber
-
Registered User
hi,
There are some confusions in your code.
I commented some of it:
code:
this.createEmptyMovieClip("outer_mc", 1);
this.outer_mc.createEmptyMovieClip("inner_mc", 1);
addPicture_btn.onPress = function()
{
var newDepth = outer_mc.getNextHighestDepth(); // getNextHighestDepth() doesn't take arguments
outer_mc.inner_mc.loadMovie("001.jpg"); // loadMovie() doesn't take a level, it only takes a target
// which in this case is outer_mc.inner_mc
outer_mc._x = 210;
outer_mc._y = 220;
};
outer_mc.onPress = function()
{
this.startDrag();
};
outer_mc.onRelease = function()
{
this.stopDrag();
};
this.createEmptyMovieClip("outer_mc2", 10);
this.outer_mc2.createEmptyMovieClip("inner_mc", 10); // it's outer_mc2, not outer_mc
// as it's the inner mc (it's on a different timeline), you don't have to assign it a different name
// inner_mc will do just fine, and most of the times, for coherence, it's the best solution
addPicture2_btn.onPress = function()
{
var newDepth = outer_mc.getNextHighestDepth(); // same as above
outer_mc2.inner_mc2.loadMovie("002.jpg"); // same as above
outer_mc2._x = -210;
outer_mc2._y = -20;
};
Are you sure you want to use onPress() or could it be onRelease() ?
-
Registered User
this may be the logi that you're looking for:
code:
this.createEmptyMovieClip("outer_mc", 1);
addPicture_btn.onPress = function()
{
var newDepth = outer_mc.getNextHighestDepth();
outer_mc.createEmptyMovieClip("inner_mc"+newDepth, newDepth);
outer_mc["inner_mc"+newDepth].loadMovie("001.jpg");
outer_mc._x = 210;
outer_mc._y = 220;
};
i.e., create different movie clips on different levels inside the outer_mc.
-
re
Thanks for the reply nunomira.
I placed the code you sent onto the first frame of the movie, and nothing happens (no pics load after the btn is pressed).
I am sure I have not done something right, I am still learning actionscript.
Can you help me with what I am doing wrong.
Thanks again,
xcaliber
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
|