Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

2,606 profile views

khadesa's Achievements



  1. Whatever you're getting paid Carl, it's not enough. Thankyou thankyou thankyou i tried mc.this.mouseX, but ofcourse it didn't like it, so i created a class for mc thinking it would be recognised then... I am new to the whole class system, have always kept code in the timeline, after hearing about how thats bad practice, and how many advantages there are in class files, classes are obviously the way to go. Thankyou for putting it so simply with such a great explanation, Thanks again Carl,
  2. Hey everybody, Carl & Jack in particular So heres the cause of my insomnia. Making a basic fish pond game, (like koi pond) in flash. I have got throwprops scolling working beautifully on the background (called "mc"), which sits on the stage. The stage is 800px by 480px, the background mc is 2400 by 480. I have fish swimming about, which swim to where the user last clicked. Long story short, everything is working perfectly, except if the user clicks to the right of stage, (eg: y>800), it won't work, the fish will not swim past 800, even though i can scroll across, they will not follow, But in the dimensions of the stage, they work a treat. Its as if throwprops is sliding the stage to left as well? there is a lot of code for this one, so i'll just show whats relevant, let me know if theres something you want to see, Throwprops on background ("mc"): // TweenPlugin.activate([ThrowPropsPlugin]); //var bounds:Rectangle = new Rectangle(0, 0, 800, 480); ThrowPropsPlugin.track(mc, "x"); mc.addEventListener(MouseEvent.MOUSE_DOWN, bg2down); function bg2down(event:MouseEvent):void { TweenLite.killTweensOf(mc); mc.startDrag(false, new Rectangle(bounds.x, 0, -1600, 0)); mc.stage.addEventListener(MouseEvent.MOUSE_UP, bg2up); } function bg2up(event:MouseEvent):void { mc.stopDrag(); mc.stage.removeEventListener(MouseEvent.MOUSE_UP, bg2up); var xOverlap:Number = Math.max(0, mc.width - bounds.width); ThrowPropsPlugin.to(mc, {ease:Strong.easeOut, throwProps:{x:{max:bounds.left, min:bounds.left - xOverlap, resistance:200}}}, 10, 0.25, 1); } Aquire MouseX, MouseY for fish ("redfish") // private function updatePosition():void { // check if mouse is down if (_isActive) { // update destination _destinationX = stage.mouseX; _destinationY = stage.mouseY; // update velocity _vx += (_destinationX - this.x) / _moveSpeedMax; _vy += (_destinationY - this.y) / _moveSpeedMax; } else { // when mouse is not down, update velocity half of normal speed _vx += (_destinationX - this.x) / _moveSpeedMax * .25; _vy += (_destinationY - this.y) / _moveSpeedMax * .25; } // apply decay (drag) _vx *= _decay; _vy *= _decay; // if close to target, slow down turn speed if (getDistance(_dx, _dy) < 50) { _trueRotation *= .5; } // update position this.x += _vx; this.y += _vy; } Any help/suggestions/advice would be very appreciated, Thanks everybody. Happy programming :]
  3. Hey everybody, I am trying to make my background scroll smoothly according to the user's drag, window (stage) is 800 by 480, background (lvl1_blitmask) is 2400 by 480 It's scrolling quite nicely, but not perfectly, it skips and jumps around toward the right side of stage. It is surely a matter of the maths involved, im afraid i just comprehend where... Here is the code: function mouseMoveHandler(event: MouseEvent): void { if (blitMask.bitmapMode == false) { blitMask.enableBitmapMode(); } var x: Number = this.mouseX - xOffset; if (x > bounds.left) { lvl1_blitmask.x = (x + bounds.left) * 0.5; } else if (x < bounds.left - xOverlap) { lvl1_blitmask.x = (x + bounds.left - xOverlap) * 0.5; } else { lvl1_blitmask.x = x; } blitMask.update(); var t: uint = getTimer(); //if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second if (t - t2 > 50) { x2 = x1; t2 = t1; x1 = lvl1_blitmask.x; t1 = t; } event.updateAfterEvent(); } function mouseUpHandler(event: MouseEvent): void { lvl1_blitmask.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); lvl1_blitmask.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); var time: Number = (getTimer() - t2) / 1000; var xVelocity: Number = (lvl1_blitmask.x - x2) / time; ThrowPropsPlugin.to(lvl1_blitmask, { throwProps: { x: { velocity: xVelocity, max: bounds.left, min: bounds.left - xOverlap, resistance: 1000 } }, onUpdate: blitMask.update, ease: Strong.easeOut }, 10, 0.5, 1); I have also uploaded the flash cc file, Thanks anybody who can spare a sec, LeonardTheLeopardV2.zip
  4. Arrrrgggghhhhh, serious? You are the man Carl, thanks heaps, Boy oh boy do i feel silly. At least it wasn't syntax this time... Okay, so i have a real question this time, How can i make the buttons clickable/touchable? I have used a mouse.click event and added TweenLite.to(blitMask, 0, {scrollY:0, onComplete:blitMask.disableBitmapMode}); To the mouse Up function, i know i'm on the right track, but i can only to manage to get the buttons too clickable (every time you drag) or not clickable at all using this line in various positions, What method would you recommend to accomplish this? Where should the disableBitmapMode sit? Is there a more efficient way? Thanks Carl, and everybody at greensock, By the way, i am determined to publish a tutorial on this topic :]
  5. Can anybody spare a glance? i've tried for so long and cannot get anywhere... :[
  6. Hey Guys, Thanks for the suggestions! i've think i've modified the code nicely enough for the menu, however, the problem i have now is that the list seems to have a mind of its's own when i release, i cannot seem to find the values to be modified to correct this... where to position the object on mouse up.. i have put together a very basic example to clarify, would love to know what i'm missing, Thanks again! SmoothScrollerV3.zip
  7. Helly everybody, I was hoping someone out there might be able to provide some info on applying the greensock throwprops plugin to a vertical scrolling nav menu for an android app. I have tried modifying the code from the throwprops page, but it uses a textfield, i want buttons inside a movie clip... Is that even possible? Can anybody point out any useful tuts or articles? or would someone like to view the file? Thanks a bunch everybody, Alex