SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    makati
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to scroll/zoom a map in Flash?

    flash newbie here.

    im a GIS user and have converted various layers of my map into vector graphics. how do i use these layers in flash?

    i've already have these different layers in flash mx.


    - i want to scroll through the map (east/west/north/south),
    - i want to zoom in and out of the map
    - show/hide layers of my map.


    how should i do this? any help would do, thanks!

    (create buttons for) showing and hiding layers? how do i do this?
    buttons for moving east, west, north or south?

    do i move my map (layer2) in flash, or do i move my browsing window (layer1) to a corresponding place in my map?

  2. #2
    SitePoint Guru JoePrice's Avatar
    Join Date
    Jan 2002
    Location
    UK
    Posts
    673
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok
    here's a couple of pointers
    1) have the 1 map as a movieclip, place it on the stage and give it the name of "map"
    2) have 4 buttons on the stage (north, south,east,west)
    3)typical actionscript for each button would be something like:
    [code]
    on(release){
    _root.map._x += 5; //move map in an easterly direction
    }
    4) zooming in would require use of _xscale and _yscale commands in actionscript i expect

  3. #3
    Romans 12:2 codyrockx's Avatar
    Join Date
    Jul 2003
    Location
    Newberg, Oregon
    Posts
    422
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ya, like buzz said you would use some codes like the ones below
    Code:
    #Flash -- scrolling east
    on (release) {
       map._x += 5;
    }
    #Flash -- zooming in
    on (release) {
       map._xscale += 5;
    }
    Codyrobert.com - Designer and Developer

  4. #4
    SitePoint Member
    Join Date
    Mar 2004
    Location
    makati
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot. will try that.

  5. #5
    Also available in Large Si's Avatar
    Join Date
    Sep 2002
    Location
    Walsall, UK
    Posts
    1,911
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just put an example together to see this working and it works fine.

    One thing though - at the moment, action is only taken on each individual mouse-click. How can the actions repeat while the mouse button is held down?
    Si
    Are you a Photoshop Jedi Master? Prove it!

    Is funky house your bag? You'll love this!

    Voice
    , eyes, ears, body and hands.


  6. #6
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Leeds
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bigsi
    One thing though - at the moment, action is only taken on each individual mouse-click. How can the actions repeat while the mouse button is held down?
    I found this post while trying to do the exact same thing myself. After working out how to do it, I thought I'd give you the benefit of my toils!
    I've got a scroll up/down/left/right as well as a zoom in/out function. The only thing I can't get to work exactly is the central zoom registration point; it seems to move off-axis if you've scrolled to one side and then zoom again. Anyone know of a way to compensate for this?
    And please accept my apologies for forcing upon you a picture of myself in the attached file

    David
    Attached Files Attached Files

  7. #7
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Los Osos
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    registration issues

    Here ya go. You were very close to getting it right. Registration issues were getting in the way. To fix it I did the following:

    * turn the image into a movie clip called zoomObj and center register it within the original mc
    * in your move functions, rather than move the big mc itself, all you have to do is move the new movie clip (zoomObj) within it and the registration issues are solved

    Nice code by the way. Clean.
    Attached Files Attached Files

  8. #8
    SitePoint Member
    Join Date
    Mar 2004
    Location
    St. Louis
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TheNovastar, How do you make it stop scrolling once it reaches a certain point? For instance, I am trying to make a movie clip scroll down, but once it reaches a certain point, I need it to stop scrolling even if you are still pressing down (on (press)). Can you help?
    kathy

  9. #9
    SitePoint Member
    Join Date
    Mar 2004
    Location
    makati
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use the "stop" actionscript in the particular frame you want to stop into.

  10. #10
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Leeds
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tinyk
    TheNovastar, How do you make it stop scrolling once it reaches a certain point? For instance, I am trying to make a movie clip scroll down, but once it reaches a certain point, I need it to stop scrolling even if you are still pressing down (on (press)). Can you help?
    kathy
    Kathy,

    The way I'd do it is to place an if statement in the event handler. i.e.

    on (press) {
    if (mc._x < 480) {
    mc._x += 5
    }
    }

    You could also do it the way I did with the setInterval, putting that in place of the mc._x += 5

    Sorry it's taken me ages to notice your question, I'm not a bigtime regular on this board. And thanks Losos for your input, sorted that problem out nicely!

    David

    [Edit: remove code typo]

  11. #11
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Singapore
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Novastar,

    I found your excellent code here. However, I am not too sure where to insert the mc.x += 5 to stop the movieclip from scrolling down, up. left or right.

    Can you please advise?



    Quote Originally Posted by TheNovastar
    Kathy,

    The way I'd do it is to place an if statement in the event handler. i.e.

    on (press) {
    if (mc._x < 480) {
    mc._x += 5
    }
    }

    You could also do it the way I did with the setInterval, putting that in place of the mc._x += 5

    Sorry it's taken me ages to notice your question, I'm not a bigtime regular on this board. And thanks Losos for your input, sorted that problem out nicely!

    David

    [Edit: remove code typo]

  12. #12
    SitePoint Member
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    also confused.

    I"m also not getting how to limit the scroll, did any one sort this out?

    Originally Posted by TheNovastar
    Kathy,

    The way I'd do it is to place an if statement in the event handler. i.e.

    on (press) {
    if (mc._x < 480) {
    mc._x += 5
    }
    }

    You could also do it the way I did with the setInterval, putting that in place of the mc._x += 5

    Sorry it's taken me ages to notice your question, I'm not a bigtime regular on this board. And thanks Losos for your input, sorted that problem out nicely!

    David

    [Edit: remove code typo]

  13. #13
    SitePoint Member
    Join Date
    Dec 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Hi Guys,

    I would like to create a similar project in functionality but different application.

    Example: We use a high resolution version of the picture of Mona Lisa. The user screen is the size of the head only. So I want the user to be able to click on some buttons that stay on the screen (HUD style) and through these buttons - to navigate to different areas of the screen.
    The buttons are, e.g. "Face", "Hands" and "Horizon."

    When the user clicks on "Hands" the screen moves smoothly to the hands of Mona Lisa.

    When the user clicks on "Horizon", the screen moves to show the horizon of the painting.

    So how can I make the buttons lead to a specific part of the image with a specific zoom property?

    Thanks a lot


Bookmarks

Posting Permissions

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