Jump to content
Search Community

MikaelB

Members
  • Posts

    8
  • Joined

  • Last visited

MikaelB's Achievements

0

Reputation

  1. Hi Carl I'm working on an app for iOS where I want to load content dynamically from the library that contains text and graphics inside different MovieClip's. However, I have a problem, the code I have is for bitmap! How can I change it so it works for MovieClip instead? I want to use the MovieClip instead of bitmap? Also want to use the MovieClip class instead of Sprite class? LIke this, but this guy use Bitmaps and Sprite. Tablet Swipe Gestures, building a nice photo gallery for the iPad. http://www.gotoandlearn.com/play.php?id=145 Please help me Please help me Best Regards Mikael (No. pro in AS3)
  2. Hi I have a little problem and I wonder if there is a cheerful soul out there who could help me. I would like to load some movieClip's dynamically from the library when I scroll and use some sort of tween with greensock. Right now my code is for bitmap and use Sprite Class. Like to use MovieClip class with greensock instead and make a MovieClipscroller (containing text and images in each movieClip). Best Regards Mikael A Club greensock member This is the code right now: var sp:Sprite = new Sprite (); addChild(sp); for (var i:int=1; i<6; i++) { var ref:Class = getDefinitionByName("p"+i) as Class; var bm:Bitmap = new Bitmap(new ref()); sp.addChild(bm); bm.x = 768 * (i - 1); } var ind:int = 0; var currX:Number = 0; stage.addEventListener(Event.ENTER_FRAME, loop); sp.addEventListener(TransformGestureEvent.GESTURE_SWIPE, onSwipe); function onSwipe(e:TransformGestureEvent):void { if (e.offsetX == 1 && ind > 0) { ind--; } if (e.offsetX == -1 && ind < 4) { ind++; } } function loop(e:Event):void { currX += (ind*768 - currX) * 0.120; sp.scrollRect = new Rectangle(currX,0,768,1024); }
  3. Thanks, I feel more "com" now. Love the pruduct I just bought, and I just LOOOOOOVE IT Makes my app fly!!!! Best Regards Mikael
  4. Just one mor question Carl When I bought the Corporate Memberships I got this cryptic addition "You can access the SVN repository for the main tweening classes here", is it intended that I should download them and replace them over the existing files (com / greensock), the one I just downloaded? Regards Mikael
  5. Thanks Carl for all your help and effords, I really appreciate it! This is my code, I have one long MovieClip in the library exported for ActionScript as MC but with one difference, instead of use the "flash.display.MovieClip" I extend it and use "flash.display.Sprite" class. My notes are both in Swedish and English, so I hope you don't get confused. Best Regards Mikael Sweden My Code: import com.greensock.*; import flash.events.MouseEvent; import com.greensock.plugins.*; import com.greensock.easing.*; import flash.geom.Rectangle; import flash.utils.getTimer; import flash.text.*; import flash.display.*; TweenPlugin.activate([ThrowPropsPlugin]); //*****************************( x y W H var bounds:Rectangle = new Rectangle(30,30,400,700); //Kom ihåg att göra om MC i "Library" under "Export for ActionScript" till "flash.display.Sprite". var mc:MC = new MC(); //i stället för att köra på "default" "Export for ActionScript" till "flash.display.MovieClip". mc.x = 30; mc.y = 30; addChild(mc); //some variables for tracking the velocity of mc var t1:uint,t2:uint,y1:Number,y2:Number; mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(mc); y1 = y2 = mc.y; t1 = t2 = getTimer(); //**************************( x y W H mc.startDrag(false, new Rectangle(bounds.x, -20000, 0, 30000)); mc.addEventListener(Event.ENTER_FRAME, enterFrameHandler); mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function enterFrameHandler(event:Event):void { //track velocity using the last 2 frames for more accuracy y2 = y1; t2 = t1; y1 = mc.y; t1 = getTimer(); } function mouseUpHandler(event:MouseEvent):void { mc.stopDrag(); mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mc.removeEventListener(Event.ENTER_FRAME, enterFrameHandler); var time:Number = (getTimer() - t2) / 1000; var yVelocity:Number = (mc.y - y2) / time; var yOverlap:Number = Math.max(0,mc.height - bounds.height); ThrowPropsPlugin.to(mc, {ease:Strong.easeOut, throwProps:{y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300}}}, 1, 0.25, 1); }
  6. Hello Carl I have finally solved the problem, I'm probably the happiest man in the world's right now! Hepp!!! Best Regards Mikael
  7. Thanks Carl for your quick answer. I did download the FLA project and I’ve been looking at the Video also but I still can’t understand how to implement this inside in my "existing code"? Tried to follow the code exemple but to sad I’m still lost (sad I know). My project is like this: The project is for Android 480x800. I have a long list, a text inside a MovieClip that is like 400 in “x” and 2000 in “y” called “drag” and a reference max and min scroll “bar”, I can scroll it as is now but I like to add the smooth scrolling as in the example project. The way it is now is that it stops abruptly as fast as I stop scrolling, like to have the feel as inside the ThrowProps project. Best regards Mikael
  8. Hello This is my first post after I’ve just become a Corporate Member, so glad to be on board I’ve been looking through many tutorials and I have an account at Lynda.com, but still I consider myself as a rookie and lost thought! Now back to my problem, I like to make an iPhone & Android smooth scrolling and use some Greensock to manage it! The problem is I can’t figure out how to implement the tweening part and which one I should use, please help me with this! Like the “ThrowPropsPlugin” and the way it smooth things out and the bounce back at the end (Flick-scrolling example). Best Regards Mikael Sweden This is my code so far: import flash.display.MovieClip; import flash.display.Sprite; import flash.events.MouseEvent; import flash.geom.Rectangle; var dragRect:Rectangle = new Rectangle(drag.x,drag.y,0,bar.height - drag.height); drag.addEventListener(MouseEvent.MOUSE_DOWN, dragMouseDown); function dragMouseDown(evt:MouseEvent):void { drag.startDrag(false,dragRect); stage.addEventListener(MouseEvent.MOUSE_UP, dragMouseUp); } function dragMouseUp(evt:MouseEvent):void { drag.stopDrag(); stage.removeEventListener(MouseEvent.MOUSE_UP, dragMouseUp); }
×
×
  • Create New...