actionscript

Unloading swf using the unloadAndStop() method, but video sounds remain audible

为君一笑 提交于 2019-12-04 05:11:02
问题 I have tried many approaches to unloading my swf, but to no avail, the video sounds within my laoded swf keep playing even once the swf has been loaded. I have created a universal loader as follows: var loader:Loader = new Loader(); I then load various swf's into a movie clip named mov_contentLoader , for example the video swf is loaded as follows: loader.load(new URLRequest("video.swf")); //assign SWF url to loader mov_contentLoader.addChild(loader); //add loaded content to movi clip I then

ActionScript 3 SharedObjects don't persist across different swfs?

老子叫甜甜 提交于 2019-12-04 05:07:10
问题 I am serving two different swfs that read and write to the same SharedObject variable. The SharedObject variable is a number, and each swf checks that number to make sure it isn't using the same number twice. It then stores the last number it selects. In this way both swfs should never use the same number twice, no matter which order they're loaded. If I repeatedly load one of the swfs, the never-twice rotation works. However, when switching back and forth between swfs, sometimes the number

flashfirebug As3 console timer or setInterval not working

…衆ロ難τιáo~ 提交于 2019-12-04 04:55:30
问题 i have tried to use a timer in the as3 console from FlashFirebug addon but it doesn't work (have tried several combinations). The timer code was this: import flash.utils.Timer; import flash.events.TimerEvent; import flash.display.Sprite; var myTimer = new Timer(1000, 2); myTimer.addEventListener(TIMER, timerHandler); myTimer.start(); function timerHandler(event:TimerEvent){trace("timerHandler: ");} //but it gives this error: Error #1034: Type Coercion failed: cannot convert r1.deval.rt:

Actionscript 3.0: Why is it a good idea to detach the code for moving an object from the object itself (eg. Ball and the Ball Mind)

回眸只為那壹抹淺笑 提交于 2019-12-04 04:46:42
问题 My questioin is pretty much in the title, Why do I keep reading in actionscript 3.0 that its a good idea to seperate the 'mind' from the 'object' when writing code? Thanks for any help, this is confusing the hell out of me. 回答1: If you're asking why graphics are separated from the positioning, movement and physics; take this tree I've drawn: In the tree you'll see that Entity has two properties: Graphics - what the entity should look like. Body - where the entity should be. Moving down, you

Listen for my Flash event in Javascript

ⅰ亾dé卋堺 提交于 2019-12-04 04:22:37
问题 I'm trying to build a basic video player with a playlist using the OVP Player. So far I have figured out how to feed in the new video source using ExternalInterface, but I can not figure out how to listen for the Flash event "EVENT_END_OF_ITEM". How do I listen for Flash events in Javascript (and thus jQuery)? OVP has a lot of events defined, but I don't know how to listen for them. For example, here is the EVENT_END_OF_ITEM: public function endOfItem():void { sendEvent(EVENT_END_OF_ITEM); }

how to kill a setTimeout() function

可紊 提交于 2019-12-04 03:42:59
问题 I use the setTimeout() function through my application but when its time to garbage collect. the method still runs and calls on a function. How do I stop it from calling on a certain function. I tried setting it to null but it doesnt work 回答1: setTimeout returns an reference to the timeout, which you can then use when you call clearTimeout. var myTimeout = setTimeout(...); clearTimeout(myTimeout); 回答2: See: clearTimeout() 回答3: I had a similar situation and it drove me crazy for a couple of

Using . or [ ] to access Object properties - what's the difference?

你离开我真会死。 提交于 2019-12-04 03:23:23
问题 What is the difference between the code (i) and (ii) written below ? (i) var obj:Object = new Object(); obj.attribute = value ; (ii) var obj:Object = new Object(); obj["key"] = value; Are there any run-time implications if I write this : var obj:Object = new Object(); obj.somekey = value1 ; obj["someKey"] = value2 ; Please explain. 回答1: The difference is in the lookup mechanism: If you use the dot syntax, the compiler will know at compile time that you are accessing a property of that object.

Ruby-like Question: Make this function shorter (ActionScript 3)

▼魔方 西西 提交于 2019-12-04 01:42:47
问题 I just wrote this incredibly verbose code to turn numbers like 2 into 02. Can you make this function shorter, please (maintaning the functionality)? public static function format(n:int, minimumLength:int):String { var retVal:String = n.toString(); var stillNeed:int = minimumLength - retVal.length; for (var i:int = 0; i < stillNeed; i++) { retVal = "0" + retVal; } return retVal; } Please use types for variables. Extra points (good-vibe points, not SO points) if there's already a built-in

AS3: defining hit area

十年热恋 提交于 2019-12-04 01:07:01
问题 I have a movieclip which contains a bitmap and I wan't to increase the hit area. I understand I can add a transparent shape behind it but this is to be compiled through air for ios and I don't want to cause unnecessary redraws. Is there a way to define a rectangle as the hit area or another solution perhaps? 回答1: There is a special hitArea field for that purposes. const MOUSE_ZONE_SIZE:Number = 10; const hitArea:Sprite = new Sprite() hitArea.graphics.beginFill( 0xFFFFFF ); hitArea.graphics

actionscript (flex): how to know whether a property of object exists (or defined)?

丶灬走出姿态 提交于 2019-12-04 00:20:50
I am a Java developer who tries Flex. Here is my problem: I behave actionScript objects as hashmap but when the object do not have the property it gives exception: No such variable. Here I expect it gave me null, instead of giving exception. So do you know is there a way to handle it, namely check if the property is defined for object. trace( obj["2008-02"] ) // gives exception Use something along the lines of if (myObject.hasOwnProperty("propertyName")) to check if the property exists. Edit: Also take a look here . BlueRaja - Danny Pflughoeft hasOwnProperty() doesn't work correctly with