Submit Your Article Forum Rules

Results 1 to 10 of 10

Thread: !!and action...script!!

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2003
    Posts
    11

    !!and action...script!!

    I have set up a movie which is to act as part of an interactive map of a building. There are four buttons which when you click upon them will zoom in on a different room (4 rooms)My problem is I want the person to be able to be zoomed in on room1 but then be able to click on room2 and have the image zoom out and then zoom in again to room2 This can be done easily if the viewer is clicking through the rooms in order 1,2,3,4 chances are they will jump around and go back and forth. I want the buttons to act in the following way...

    Example (we are in room1)

    upon clicking room 3
    zoom out of room1 to original main plan
    then zoom in on room 3

    My idea is to set an actionscript so that when I click on any room, the room that I am currently plays a zoom out (5-10 frames) and after playing this set number of frames goes to the frame designated for the start of zooming in on room 3.

    If that makes any sense to you and you have some ideas of what kind of script I should use please help. I am fairly new to this actionscript stuff but can pick things up quick.

    Thanks in anticipation

    Dan

  2. #2
    Senior Member
    Join Date
    Jul 2003
    Posts
    617
    The way I'd do it is to have each room a separate movie (if you start trying to do complex stuff on a single timeline it gets unwieldy).

    Then, depending on whether each movie is zoomed in or out, set a variable to act as a flag: r1z=1 for room 1 zoomed in and r1z=0 for zoomed out, etc.

    You could then use an if/then structure in each movie(or the switch structure) to decide what to do.

    Does that make sense?
    Sualdam

  3. #3
    Junior Member
    Join Date
    Aug 2003
    Posts
    11
    Many thanks,

    It doesn't all make sense but it gives me more of an idea of what to go on and not to create something to complex in the one timeline.

    Look out for the site when I submit it for review...

    Cheers

    Dan

  4. #4
    Senior Member
    Join Date
    Jul 2003
    Posts
    617
    If you want, when I get home tonight I can do a demo for you.

    I won't unless you ask for it - you seem to want to go for it yourself, which is fine.
    Sualdam

  5. #5
    Junior Member
    Join Date
    Aug 2003
    Posts
    11
    That would be cool, though it might be easier if you can answer this question

    can I set a movie playing for say 5 frames (not to a specified frame) and then for it to goto another specified frame. I am trying to make movie zoom1 play (then stop at a specificed point in the movie (can do this) and then have a button that when clicked will continue playing the rest of the movie and then goto a new movie as specified

    click button1
    play movie1- stop...

    click button2,3 or 4
    restart current movie (for 5-10 frames)
    go to movie2, 3 or 4
    play movie2, 3 or 4 stop...

    and so on...

    Thanks

    dan

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    617
    What you need to do is have a button/keframe on frame 1 then have another keyframe on say frame 5.

    That means you effectively have two separate buttons that you can apply actions to.

    You'll have a stop() action on frames 1 and 5 as well so that the playhead stops in those places.

    On each button put this code:
    Code:
    on(release){
    play();
    }
    Now test it.

    It will start frozen on frame 1 because of the stop() action.

    Click the button and the playhead will now play up until frame 5, then it stops again.

    Click the button again and the playhead continues, and jumps back to frame 1 when it reaches the end of the movie unless you have another stop action to prevent it.

    I'll post a sample later.

    (Note: In the simple example above you don't necessarily have to have two keyframes in the button layer because the code is the same - but in your real situation you'll want different code probably, so you'll need the two keyframes then).
    Sualdam

  7. #7
    Senior Member
    Join Date
    Aug 2003
    Posts
    765
    Would it not be just as easy, since you have to do it anyway, create a seperate voom-out movie clip for each floor/room. Then set the button with a GoToand Play function for that movie selecting a specific frame set? Example. You are in scene one within room one (stop function on say frame 125), you then have the voom-out clip on frames 135, 145, and 155. The viewer clicks on button 2 and the movie jumps to frame 135 and plays the voom-out then loads scene 2 for rooom 2. If they clicked on button 3 the movie would jump to frame 145 and zoom out and load scene 3 for room 3. Does that make sense?

    I think that would do what you want without a lot of scripting.
    Scott Brinkerhoff - Art of Zen Studios
    Web Design I Design Monk
    © 2000-forever - All rights reserved by me - SO THERE!!

  8. #8
    Senior Member
    Join Date
    Jul 2003
    Posts
    617
    If you haven't sorted it out, this might help. It uses the switch statement, which is an elegant way of handling this.

    You can see the example here (imagine the coloured squares on top of each other, and each one correpsonding to your zoom in/zoom out scenario):

    Example Movie

    If you want the FLA, it is here:

    The FLA

    (Incidentally, there is a condition in my example where two movies change at the same time, but you get the idea :))
    Sualdam

  9. #9
    Junior Member
    Join Date
    Aug 2003
    Posts
    11
    Thanks for all your help,

    I will try these ideas out. Sualdam I like how yours works, though I think mine would be a reversed instead of when clicked it would enlarge as oppose to reduce in size.

    I think I understand both and willpost the result for you to look at.

    Cheers

    Dan

  10. #10
    Senior Member Markll's Avatar
    Join Date
    Aug 2003
    Posts
    615

    Zoom

    Zoom effect is much better accomplished with actionscript.

    Example:
    http://www.localshoppernetwork.com/zoomexp/

    This is a work in progress that will ultimately be incorporated into an Abobe Photoshop Web Gallery Template for a Photographer.

Similar Threads

  1. Action Script 3 question
    By graphyx in forum Flash Discussion Forum
    Replies: 0
    Last Post: 11-03-2008, 12:17 AM
  2. Action Script Question regarding layers
    By coder in forum Flash Discussion Forum
    Replies: 1
    Last Post: 03-12-2006, 11:27 AM
  3. Action Script
    By epicweb in forum Flash Discussion Forum
    Replies: 3
    Last Post: 04-28-2004, 09:09 AM
  4. Action Script Help
    By Logan0226 in forum Flash Discussion Forum
    Replies: 1
    Last Post: 03-29-2004, 04:43 PM

Posting Permissions

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