container clip within a container

  • WhiteBug
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: KL

Post 3+ Months Ago

hie all, i'm new to this forum and so am i to flash.

i've got some usefull tutorials regarding container and loading a movie into that.

the problem is i am loading a .swf file into a container which is already in a container.. does this method work..:P

thanks.
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

Container container exercise.
Create a new movie for each of theese blocks of code, name the movies three.swf, two.swf, & one.swf.
you can make them all 300 pixels by 300 pixels.
Make sure they are all saved in the same directory (or on desktop)

Do them in this order it makes it easier to keep track. (explaination below)
three.swf wrote:
createEmptyMovieClip("square",0);
with(square){
beginFill("0x00ff00",100);
moveTo(10,10);
lineTo(90,10);
lineTo(90,90);
lineTo(10,90);
lineTo(10,10);
endFill();
}


two.swf wrote:
createEmptyMovieClip("square",0);
with(square){
beginFill("0x0000ff",100);
moveTo(10,10);
lineTo(190,10);
lineTo(190,190);
lineTo(10,190);
lineTo(10,10);
endFill();
createEmptyMovieClip("container",1);
//container.loadMovie("three.swf");
}


one.swf wrote:
createEmptyMovieClip("square",0);
with(square){
beginFill("0xff0000",100);
moveTo(10,10);
lineTo(290,10);
lineTo(290,290);
lineTo(10,290);
lineTo(10,10);
endFill();
createEmptyMovieClip("container",1);
container.loadMovie("two.swf");
}
square.onPress = function(){
_root.square.container.container.loadMovie("three.swf");
}


Now that you have one.fla hold CTRL+SHIFT & press ENTER (debugger short for thoose who don't know)

You wont see anything untill you pres the green play arrow in the debugger.

Once you press play on the debugger you should see a red square that will immediately load a smaller green square into it.

Now make sure you can see the tree view of movieclips in the debugger without any of them going off screen, make the area a little bigger than is needed as well.

Make note of what movieclips are in the view and thier path.

Click the red square, it makes the green square load a blue square.

It's all about how you target everything. I can't really explain it without sounding like a studdering fool :P

Study this line against the tree view of the debugger very close is as well as I can explain this.
Code: [ Select ]
_root.square.container.container.loadMovie("three.swf");
  • WhiteBug
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: KL

Post 3+ Months Ago

thanks alot joebert,

i was really stuck on this, will try this out.

:)
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

When I did that I changed it halfway through to add the onPress bit, I forgot to comment out the loadMovie line in two.swf I've edited it.

If it loads all three squares when you test movie without pressing anything you need to comment out the loadMovie() line in two.swf
  • WhiteBug
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: KL

Post 3+ Months Ago

this is how my codes are..

this is to call the first movie into a container....
Code: [ Select ]
on (release) {
    if (_root.currMovie == undefined) {
        _root.currMovie = "speciality";
        container.loadMovie("speciality.swf");
    } else if (_root.currMovie != "speciality") {
        if (container._currentframe>=container.midframe) {
            _root.currMovie = "speciality";
            container.play();
        }
    }
}
  1. on (release) {
  2.     if (_root.currMovie == undefined) {
  3.         _root.currMovie = "speciality";
  4.         container.loadMovie("speciality.swf");
  5.     } else if (_root.currMovie != "speciality") {
  6.         if (container._currentframe>=container.midframe) {
  7.             _root.currMovie = "speciality";
  8.             container.play();
  9.         }
  10.     }
  11. }



and within that movie, i'm callin another....
Code: [ Select ]
on (release) {
    if (_root.currMovie == undefined) {
        _root.currMovie = "business";
        container.loadMovie("business.swf");
    } else if (_root.currMovie != "business") {
        if (container._currentframe>=container.midframe) {
            _root.currMovie = "business";
            container.play();
        }
    }
}
  1. on (release) {
  2.     if (_root.currMovie == undefined) {
  3.         _root.currMovie = "business";
  4.         container.loadMovie("business.swf");
  5.     } else if (_root.currMovie != "business") {
  6.         if (container._currentframe>=container.midframe) {
  7.             _root.currMovie = "business";
  8.             container.play();
  9.         }
  10.     }
  11. }


somehow the business.swf doesnt load in the browser..but works when i CTRL + ENTER

alittle confused here.. :cry: [/code]
  • WhiteBug
  • Newbie
  • Newbie
  • User avatar
  • Posts: 9
  • Loc: KL

Post 3+ Months Ago

i think the 2nd code kinda screws the first one..

so i just put in this code:
Code: [ Select ]
on (release) {
    container.loadMovie("business.swf");
}
  1. on (release) {
  2.     container.loadMovie("business.swf");
  3. }

ans it works... :)

thanks joebert.. much appreciated..i'll post my comp. website soon in here.. :)

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 9 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.