Jump to content
Search Community

youwh

Members
  • Posts

    15
  • Joined

  • Last visited

youwh's Achievements

1

Reputation

  1. ahh, make sense. thanks for the quick solution. now i guess have to check back some of the bind I used to see if it really does what it intends to or not...
  2. this work, though will need to have it as an var rather than targeting the function directly.
  3. init():void{ gsap.ticker.add(this.check2.bind(this, body)); } protected check2($body): void { if ($body.x === 0 && $body.y === 0) { gsap.ticker.remove(this.check2); } } basically like this. if using without the bind method, it could work, but it doesn't looks pretty next time if i need to override it
  4. i'm using bind, but I can't remove the function. Comparing the basic example and the bind method i use, the function name in the listener is different. for example.. myFunction() name is "myFunction" in the listener list, but the bind method check2() name is "bound check2"? I'm not sure if just removing the object from the listeners would be the same as using gsap.ticker.remove
  5. I'm trying to set some new properties to a sound and add in to a dictionary, something like 'name', 'categories', etc My sound class: package { import flash.media.Sound; import flash.media.SoundLoaderContext; import flash.net.URLRequest; public class ExpendedSound extends Sound { public var name:String; public var categories:String; public function ExpendedSound(stream:URLRequest = null, context:SoundLoaderContext = null):void { super(stream, context); } } } but I can't seems to change or cast the loaded content to be ExpendedSound instead of a normal Sound object. var sound:ExpendedSound = loader.getLoader('sound').content; Anyway to solve this?
  6. public class BigWin { private var bgClass:Class; private var bgSpr:Sprite; private var mtx:Matrix = new Matrix() private var bgMC:MovieClip; private var mcHolder:MovieClip = new MovieClip() private var timeline:TimelineLite; private var tempMC:MovieClip private var initScore:int; private var targetScore:int; public function BigWin():void { mtx.createGradientBox(Main.game.config.swfWidth, Main.game.config.swfHeight, Math.PI * 0.5, 0, 0); bgSpr = new Sprite() bgSpr.graphics.beginGradientFill(GradientType.LINEAR, [0x000000, 0x000000], [.6, 0], [80, 180], mtx) bgSpr.graphics.drawRect(0, 0, Main.game.config.swfWidth, Main.game.config.swfHeight) bgSpr.graphics.endFill() mcHolder.addChild(bgSpr) bgClass = Main.queue.getLoader('main_uiMC').getClass('bigwinBgMC') as Class; bgMC = new bgClass() bgMC.x = (Main.game.config.swfWidth - bgMC.width) >> 1 bgMC.y = ((Main.game.config.swfHeight - bgMC.height) >> 1) - 80 mcHolder.addChild(bgMC) } public function start():void { initScore = 0; targetScore = 400 mcHolder.alpha = 0; Main.mainMC.addChild(mcHolder) TweenLite.to(mcHolder, .3, {alpha: 1}); winamount() timeline = new TimelineLite() timeline.append(TweenLite.to(MovieClip(bgMC.getChildByName('glowMC')), 1, {scaleX: 1.3, scaleY: 1.3, delay: .3})) timeline.append(TweenLite.to(MovieClip(bgMC.getChildByName('glowMC')), 1, {alpha: 0})) } private function winamount():void { tempMC = MovieClip(bgMC.getChildByName('winAmountMC')) as MovieClip TweenLite.to(tempMC, 0, {glowFilter: {color: 0x69FF00, alpha: .9, blurX: 2, blurY: 2, strength: 4, quality: 3}, dropShadowFilter: {color: 0x000000, alpha: 0.7, blurX: 12, blurY: 12, strength: 2, angle: 90, distance: 0}}) TweenLite.to(tempMC, 1, {initScore:targetScore, onUpdate:updateScore, ease:Linear.easeNone}); } private function updateScore():void { trace(initScore, targetScore) } } Currently the trace back result for initScore is 0. Not sure y it does not adds up
  7. i cant get it to work. is the function still supported?
  8. Let's say I have a image slider that I want it to scroll when I click on a button. But I do not want it to be the same order every time I click on the image. If the image width is about 100px, can blitMask just cut out 100px from it and random rearrange it when it scrolls? And if the image have an event I want to trigger, I need to remove the 'disableBitmapMode' when the animation stop. But when I disable it, the 'copied' image will be removed making the slider be out of the screen, or in a different position when it stopped. Or a better way to do it would be using enter Frame?
  9. hm, thanks for the help! Guess I have to see if there is anyway to convert Starling DisplayObject to use a default DisplayObject
  10. I have a class that is using starling framework, and I'm trying to use LoaderMax to loads in a swf, but it returns the error col: 13 Error: Implicit coercion of a value of type com.greensock.loading.display:ContentDisplay to an unrelated type starling.display:DisplayObject. This is my code: package { import com.greensock.events.LoaderEvent; import com.greensock.loading.display.ContentDisplay; import com.greensock.loading.SWFLoader; import starling.display.Sprite; import starling.core.Starling public class Game extends Sprite { private var queue:SWFLoader private var mm:ContentDisplay public function Game():void { queue = new SWFLoader("MainMenu.swf", {onComplete: completeHandler}) queue.load() } private function completeHandler(e:LoaderEvent):void { mm = queue.rawContent addChild(mm) } } }
  11. Do TweenLite/TweenMax/LoaderMax or what ever awesome stuff greensocks have, have a function to do a full remove/cleaning like how we would normally set something to 'null' to let Garbage Collection to clean it up? Or it will clean up it self automatically?
  12. I'm working on away3D that loads a .obj model. I noticed that my model won't tween unless I make it render on ENTER_FRAME. Is it the way it is, or there's another way around without having to run ENTER_FRAME?
  13. I have multiples object animation running on random speed (end time) , and it will restart when its animations end TweenLite.to (e,randomTimeB, {x:randomXA ,onComplete:lineAnimation, onCompleteParams:[e]}); While the animation is playing, I have a timer to check the correct speed it should be private function timesUp (e:TimerEvent):void { checkXML (); checkCondition (); (define correct speed) } How can I restart all the animation, since the 'e' is multiple object with random speed and ends/restart on different time?
  14. It works! Thanx! Can we interrupt an ongoing animation? For example, base on the previous question, the animation is moving very slow like 10 seconds. Then in between that 10 seconds, some conditions have changed, and I want the function to re-start, base on a new speed given. if(slow){ TweenLite.to (e,randomTimeA, {x:randomXA ,onComplete:lineAnimation, onCompleteParams:[e]}); } else if (fast){ TweenLite.to (e,randomTimeB, {x:randomXA ,onComplete:lineAnimation, onCompleteParams:[e]}); }
  15. I have multiple object doing random movement with random speed. i wanted to repeat the animation. I tried to use onComplete to restart each object once the animation end, but how could I specifically target it to that object? private function lineAnimation (e:DisplayObject):void { TweenLite.to (e,randomTime, {x:randomX, onComplete: lineAnimation(e)}); }
×
×
  • Create New...