The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • Flash Newbie
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 Flash Newbie

  • kallok Author 
    • 413 
    • 0 
    • 9 
    Dragable flash?
    kallok

    Last reply Mar 12 2006, 11:57 PM

    by kallok

    Posted: Mar 12 2006, 03:31 AM

    by kallok

     

I came across this website (http://www.conceptm.nl) and I was wondering if anyone knew of any tutorials out there on how to make a site that you can drag just like this. I can’t seem to find any good help. Thanks!

  9 REPLIES
 
bambi
1  
bambi

[as]
class Draggable extends MovieClip{

  var down : Boolean = false;

  function onMouseDown(Void):Void{
  down = hitTest(_root._xmouse,_root._ymouse);
  }

  function onMouseUp(Void):Void{
  down = false;
  }

  function onMouseMove(Void):Void{
  if(down){
    _x = _parent._xmouse;
    _y = _parent._ymouse;
  }
  }

}[/as]

  • 12 March 2006 06:45 AM
  •  
Nutrox
2  
Nutrox

You could also have a look at MovieClip.startDrag() and MovieClip.stopDrag() methods in the Flash Help docs. good

If you set Flash’s wmode parameter in your HTM file though then I would use a custom class like bambi’s up there^ to avoid a little Firefox/Mozilla bug.

  • 12 March 2006 09:30 AM
  •  
bambi
3  
bambi

yeah, and you can’t use easing with startDrag (afaik).

  • 12 March 2006 02:00 PM
  •  
kallok Author 
4  
kallok

thanks, that helped!

  • 12 March 2006 03:21 PM
  •  
kallok Author 
5  
kallok

Actually, I’m still having big problems, I’m a bit rusty with my Actionscripting frown. I had it working then it decided to just not drag at all. I also can get the MovieClip.startDrag() and MovieClip.stopDrag() to work, but I want it to have the easing. If anyone could just look at my file and get it working, that would be great.

http://www.indieyoungstown.f2o.org/drag.fla

  • 12 March 2006 08:16 PM
  •  
bambi
6  
bambi

there’s no code in that file

  • 12 March 2006 08:23 PM
  •  
kallok Author 
7  
kallok

I know I removed it because it was a mess. I don’t even know where to begin.

  • 12 March 2006 10:32 PM
  •  
bambi
8  
bambi

my code above is a subclass of MovieClip.

in your file, the clip on the stage needs to be draggable. take my code, create an as file and save it as Draggable.as in the folder with the fla.

go to the clip in the library, and rename it Draggable. then right click on it and select Linkage… enter Draggable for both the identifier and the AS 2.0 class. check “export for actionscript” if necessary.

  • 12 March 2006 11:27 PM
  •  
kallok Author 
9  
kallok

yes! I did the part about saving it as Deaggable.as wrong. This was bugging me all day, thanks again!

  • 12 March 2006 11:57 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 779  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,728  Assets
  • Profiles 282,751  Members
  • Topics 93,776  Topics
  • Blog 4  Blog
  • Facebook 1,679  Facebook
  • Twitter 1,163  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 11, 2012 - 19:20:33