A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [f5]

  1. #1
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    [f5]

    I have recently started to use Actionscript on buttons. I need to make about 12 buttons each call up their own short movie of about 60 frames onto the picture on the stage. I would like each movie to be able to continue playing even after another one is brought onto the stage. Can this be done, and HOW?

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    questions:

    You're with Flash 5?
    Your movies have a stop() on the first and last frame?
    Your movies are only in the library, or on the Stage, or are external swfs?
    What is the 'picture on the stage'? a graphic, a movieclip? just a bitmap?

    gparis

  3. #3
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    Fl5 12 movies

    Hello Genevieve! My movies are in my library. They don't have a stop on 1st and last frame yet but I could do that. The picture on the stage is just drawn straight onto the stage, in layers (does this mean it's a bitmap?). The buttons are actually parts of the picture to be clicked on, each on a different layer. Each button is saved in the library.

  4. #4
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Ok. You have enough room on the stage to have multiple movies playing at the same time?

    You can use attachMovie() :
    The parameters are:
    Linkage name (the identifier you give in the library>linkage)
    new name (the name of the attached symbol)
    The depth (you will have to use different depths, you cannot have 2 objects at the same depth - see below the 2 examples)
    and last the _x and _y coordinates

    example1:
    Code:
    on (release) {
    	this.attachMovie("movie1",movie1,1,{_x:100,_y:200});
    }
    example2:
    Code:
    on (release) {
    	this.attachMovie("movie2",movie2,2,{_x:400,_y:100});
    }
    gparis

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    if your movies have no stop() actions anywhere they will keep playing automatically.

    gparis

  6. #6
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14
    Ok, thank you! I will try this.
    The movies that I want to bring onto my stage when I click on my buttons are fairly small, simple animations of small garden creatures, eg a bee or a caterpillar.
    As I am fairly new at Flash and completely new to the Flashkit forums, I'll need some time to work on this...I'll try it tomorrow and hope to get back to you with any questions some time this weekend...Alitween

  7. #7
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    AttachMovie: It works in Generator file only(?!?)

    Thank you, Genevieve, for your instructions on how to attach a movie to my movie.

    I got this to work, eventually...(Yes, I'm new to ActionScripting!) but find that it only works in the file marked 'Generator Template'...I'm even newer to this! I think I switched on Generator accidently. Anyway, the attached movie now appears when I click my button in the main movie in the swf file marked Generator Template, but the movie appears too big. I know how to modify the size of a movie when it is on the stage but is it possible to shrink it in the library?

    Also, how do I switch off Generator as I am not yet ready to use this?


  8. #8
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    If i remember correctly, Generator came with Flash5 but got discontinued. I'm not even sure i tried it at the time. In any case close Generator and come back to Flash5.

    So... my Flash5 syntax is a bit far now. I think you'll need to write it differently. Here goes:

    Code:
    on (release) {
    	this.attachMovie("movie1",movie1,1);
            this.movie1._x = 100;
            this.movie1._y = 200;
            this.movie1._xscale = this.movie1._yscale = 50;
    }
    _xscale and _yscale are the scale properties of the movie. 50 means 50%.

    gparis

  9. #9
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    Generator off is better. Now to rotate my movie...

    Hello Genevieve!
    I managed to turn off Generator in File>Publish Settings box and unticking Generator Template. Now at least the action has returned to my swf file!

    But 'fraid I didn't manage to change the size of the picture in the movie the way you suggested; I ended up duplicating the movie and modifying each keyframe of the movie. At least my caterpillar is the right size for the movie now.

    Now I need to rotate it by -80 degrees and cannot see a way to do this. Can you suggest something please? (I found the rotate command and added minus 80 degrees but it didn't seem to do any rotating.)
    What I'm trying to do is make a caterpillar move down the stem of a sunflower rather than just move horizontally across the screen. (The caterpillar doesn't appear until the sunflower button is clicked on).
    Alitween

  10. #10
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    I've rotated my movie but cannot place it correctly...

    I have managed to rotate my movie by placing it into another movie and doing 'Transform>Size and Rotate' on it. Sorry if this all sounds a bit basic and obvious but it's the first time I've done this and maybe it is not the only way to do it? (I long to learn more!)
    So now I have my caterpillar going down the page at 80 degrees after calling him up with the Sunflower button but I have not yet managed to place him correctly; He comes onto the screen when the Sunflower button is pressed...EVENTUALLY! (in the last seconds of his walk he appears in the top left-hand side of the screen) This is because he starts is journey way-off the screen, high above it.
    I have tried changing the x and y co-ordinates but this seems to make no difference. So, at present, the Actionscript on my Sunflower button is:
    on (release){
    this.attachMovie("CPMA1",CPMovesAngle,3,
    {_x:0,_y:0});
    What am I doing wrong??! Alitween

  11. #11
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    Problem wit the initObject (that part here: {_x:0,_y:0}) is that it doesn't seem to work in version 5. That's why i posted an alternative. Try this:

    on (release) {
    this.attachMovie("CPMA1","CPMovesAngle",3);
    this.CPMovesAngle._x = 0;
    this.CPMovesAngle._y = 0;
    }

    should place the duplicate at 0,0.

    gparis

  12. #12
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14

    It works! Now I need the attachedMovie to be behind a button...

    Hurray, it works! Thank you! (Forgetting to put the attached symbol in quotes held me up for a bit!)

    Now I just need this attached movie (the "CPMovesAngle") to be on a layer that is behind a button on the main stage. I understand about the need for the attachedMovies to be at different depths. How can I make a button in the main movie be infront of all the other layers (including the attached movies)? I guess it needs to be given a depth, but how?

    Al

  13. #13
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    You could use swapDepths() but it works better with dynamic symbols (created via attachMovie or duplicateMovie - createEmptyMovieClip only works with later versions of Flash) Plus swapDepths() is more appropriate when swapping depths more than once, or actually swapping with another object,

    So, what i suggest is to either attach (which you now know how) or duplicate (which is pretty similar) that symbol on a higher depth.

    gparis

  14. #14
    Junior Member
    Join Date
    Feb 2007
    Location
    Brighton, Sussex, UK
    Posts
    14
    Frustratingly, I still have a problem:
    When I have used attachMovie before, it has been to bring in another movie clip, from the library onto the stage, when a button is clicked. I have then been given the ability to set the depth of the movie being brought in.
    But here, I want to set the depth of a button that is already on the stage and not even been clicked on. This button (which happens to be in the shape of a leaf) needs to be infront of the caterpillar (which is a movie called 'CPMovesAngle' which was brought in when the SunflowerButton was pressed). The LeafButton needs to be on a layer that is infront of the caterpillar even before it is clicked on. (Infact, when the leaf is eventually clicked on, a butterfly will emerge...I look forward to doing this bit...)
    But I just cannot get the leaf to be infront of the caterpillar.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center