actionscript

Actionscript - Adding EventListener to multiple buttons on stage

一个人想着一个人 提交于 2019-12-12 02:26:43
问题 I have a little problem with adding EventListener to multiple objects on stage. I have above 40 buttons on stage named "Button01","Button02" .. "Button40", and i'm looking for easiest way to add EventListener to all of them. Creating something like Button01.addEventListener(MouseEvent.CLICK, doSomething) Button02.addEventListener(MouseEvent.CLICK, doSomething) .. Button40.addEventListener(MouseEvent.Click, doSomething) (Notice the same function). isn't solution i'm looking for :(. Thanks in

Width of MovieClip is minus 100 million (-1.073741604E8)

北城以北 提交于 2019-12-12 02:18:15
问题 My application works fine, but I have a function, what calculates a minimap based on the width of the original MC, but it doesn't work when the width is negative. So the question is basically, how can width be negative? what does it mean? thanks --edit: sorry, I can't post any code, it's a 30K LOC project. The solution was to include this in another movieClip, where it worked better. 回答1: I expect your MC which width you're measuring is not on stage right now. I'm experiencing the same issue

AS3: Find distance of rotation

醉酒当歌 提交于 2019-12-12 01:56:15
问题 I am rotating an object with TweenLite, however instead of a set duration I want the duration to be based upon the distance of rotation where 180 degrees = 3 seconds 90 = 1.5 and so on. Here is my attempt to find the distance of rotation: var time:Number = Math.abs(Math.atan2(Math.sin(angle-wheelObj.rotation),Math.cos(angle-wheelObj.rotation)); TweenLite.to(wheelObj, time, {shortRotation:{rotation:angle}, ease:Expo.easeOut, onComplete:rotateWheel, onCompleteParams:[target]}); TweenLite.to

Action Script 3. How to remove child which is created from another function?

依然范特西╮ 提交于 2019-12-12 01:43:08
问题 I have added child with function first , and I need to remove It with function third . function first(event:MouseEvent):void { addChild(test); //here add child button.addEventListener(MouseEvent.CLICK, second); //here add listener to second function } function second(event:MouseEvent):void { third(event); //here I call third function } private function third(event:Event):void { removeChild(test); //here should delete child, but I got error } But I got following error: ArgumentError: Error

flash.net.URLRequest call stays in pending

前提是你 提交于 2019-12-12 01:39:53
问题 I've got this flash/flex application and issue with URLRequest call. When call is made to server I get content just fine. After that content is stored in cache and next time URLRequest uses local cache to retrieve it. Sometimes it works, but sometimes call is never finished - stays in pending . I'm using latest flash player and different browsers. On my computer I can replicate issue using chrome and colleague can replicate on firefox. I've looked at flash player log files and there's nothing

create arraycollection with different name

拟墨画扇 提交于 2019-12-12 01:36:34
问题 I would like to create a new AC instance with a dynamic variable which is nca1, nca2, etc. Without define using hardcode variable name, it is possible to do that in a loop? 回答1: I'm afraid you are missing the point here, getDefinitionByName gives you a class instance, you cannot create a variable with a dynamic name this way. This is how you create an instance per reflection: var symbolClass: Class; var s: ArrayCollection; symbolClass = getDefinitionByName("mx.collections.ArrayCollection") as

Random colour within a list of pre-defined colours

拈花ヽ惹草 提交于 2019-12-12 01:33:45
问题 Here is my actionscript that edited from http://circlecube.com/2009/02/random-movement-brownian-revisited-for-as3/: //number of balls var numBalls:uint = 50; var defaultBallSize:uint = 8; //init makeDots(); function makeDots():void { //create desired number of balls for (var ballNum:uint=0; ballNum<numBalls; ballNum++){ var c1:Number = randomColor(); var c2:Number = randomColor(); //create ball var thisBall:MovieClip = new MovieClip(); thisBall.graphics.beginFill(c1); //thisBall.graphics

Animation code not fired when mouse is out Clip1 but mouse is inside clip 2

[亡魂溺海] 提交于 2019-12-12 00:32:35
问题 Problem: When I move the mouse cursor out of Clip 1 but is above Clip 2, the MOUSE_OUT of Clip 1 does not work. Expectation: Granted that the mouse is inside Clip 2, the location of the mouse is outside of Clip 1 already, so the function mouse_out() of Clip 1 should fire the code inside it. Full code: I am attaching the full code so far. import flash.display.MovieClip; cat1.addEventListener(MouseEvent.MOUSE_OVER,mouse_over); cat1.addEventListener(MouseEvent.MOUSE_OUT,mouse_out); cat2

I need Adobe AIR For Android Encrypted Local Store or Application Storage data to persist even after uninstalling or updating the app.

我的梦境 提交于 2019-12-12 00:28:29
问题 According to Encrypted Local Store documentation, ELS should persist as long as the Android AIR App's application ID is kept the same even though the app version number is different. Unfortunately this is not the case based on my experience. I have set the stronglybound paramater to false as well. Sample code here: //saving var baWrite:ByteArray = new ByteArray(); baWrite.writeObject(appData); EncryptedLocalStore.setItem(APP_DATA_NAME, baWrite); //loading var baRead:ByteArray =

fileReference browse from js, simulate keypress in flash workaround

99封情书 提交于 2019-12-11 23:37:51
问题 I am trying to call fileReference.browse from outside the flash SWF, i read some articles that said normally it's imposible due to Flash 10 security stuff.. so i was wondering isnt it posible to send a command from js to flash which will simulate a keypress inside the flash, which (this keypress) will trigger the fileReference. Thank you in advance, Daniel! 回答1: It's impossible (it would create quite a serious security risk). You can confirm this by checking any uploader module out there that