actionscript

AS3 stage = null?

会有一股神秘感。 提交于 2019-12-02 01:59:48
问题 I've just tried to implement a menu system I saw a tutorial onto a game that I'm working on and it was all smooth sailing until I've now encountered a problem with the stage being set to null and I don't know how to stop it. The line that keeps breaking it is in the AvoiderGame.as file and is the stage.addEventListener(Event.ADDED_TO_STAGE, init); it keeps returning the following error TypeError: Error #1009: Cannot access a property or method of a null object reference. at AvoiderGame()[M:

Differentiate between F5 and browser close event in flex/actionscript

两盒软妹~` 提交于 2019-12-02 01:59:41
问题 I am using the following piece of code to determine the closure of browser window and it works perfectly. But the issue arises when the user refreshes the page using "F5" or clicking browser refresh button and even in that case the same piece of code is invoked. I would like to know if there is anyway by which i can distinguish between browser close event and refresh event using actionscript package utils { import flash.external.ExternalInterface; public class ExternalInterfaceUtil { public

currentFrame of root timeline from inside object

北城余情 提交于 2019-12-02 01:51:27
Is it possible to pull the currentFrame of the root timeline from inside an object class? Normally a currentFrame call only checks the frame of the movieclip it's attached to within an object class, so how would you go about checking the frame of the entire project from within the object class file? edit: Nevermind, I found what I was looking for. All you have to do is use MovieClip(root).currentFrame and it works just fine. Consider the question answered. Cap'nAhab Nevermind, I found what I was looking for. All you have to do is typecast root to MovieClip like this: MovieClip(root)

handling ctrl + key event in IE browser

戏子无情 提交于 2019-12-02 01:46:20
问题 I'm using hotkeys ( Ctrl + key ) in my flex application. getting problem when my app is running in IE. when I press Ctrl + D , im getting 'Add a Favorite' window of IE. How should I override the default behaviour of the browser? if possible, give me some example. 回答1: In your event handler, try event.returnValue = false; See this SO thread: event.preventDefault() function not working in IE 来源: https://stackoverflow.com/questions/2364004/handling-ctrl-key-event-in-ie-browser

Customizable / Dynamic SWF generation

我是研究僧i 提交于 2019-12-02 00:33:31
Wondered if anybody knows how customizable Flash swf files are made, where there appears to be a template swf that the user can then input some changes (eg text or image) and receives a newly-compiled swf file with their changes. Some examples: - http://flashfreezer.com/landingconfetti/index.html Constraints: - user receives a single output swf file that can be played with all their changes included. ie there is no reading from an xml file, or using Flashvars. Been trying different things for a few weeks with no luck! There are a number of ways, but generally the most common is to either use a

How do I make flex only consume mouse scroll and keyboard events when it's useful, and otherwise pass it on to the browser?

£可爱£侵袭症+ 提交于 2019-12-02 00:09:13
问题 This one's been irking me for a while. When I'm using the mouse scroll wheel to scroll up and down in a webpage, and a flash movie comes into the path of the cursor, the scroll wheel stops working. Also, when a flash movie has focus, you can't use browser shortcuts like Ctrl + L or Ctrl + R . I'm writing a flex application now and I'd like to find a solution, so that at least my users aren't plagued by this inconsistency of the user interface behavior. I should think there would be a way to

How to completely remove a movieclip in AS3

半城伤御伤魂 提交于 2019-12-01 23:54:16
问题 I want the mc to be removed with All its timers, events,... Is there a simple way to do this? 回答1: Sure... unregister its timers and events, remove it from its parent, and delete all references to it. ;) That is, AS3 is a garbage collected language, so you can't control when an object (including a MC) is really deleted from memory. When you delete all references to it (including event registration), the GC will detect that it is no longer needed and clean it up for you. One thing you can (and

Actionscript 2 large tile-based maps creating lag

江枫思渺然 提交于 2019-12-01 23:44:54
I'm wondering what the best way to go about creating large, tile-based maps in flash with actionscript 2 would be. With my current code, any maps over 35x35 (1225 movieclips) start to lag. The maps are created from a simple multi-demensional array, eg. var map = [[95,23,25,23,16,25],[95,23,25,23,16,25],[95,23,25,23,16,25]]; The program simply creates a movieclip of a tile, goes to the appropriate frame and places the tile relative to the player's location. Each tile has one property, that is 'walkable' which is either true or false which determines if the player can walk on it or not. These

Which Flash/Actionscript IDE to use — if one should be used at all?

心不动则不痛 提交于 2019-12-01 23:38:49
I've always used the built-in IDE, but I've been gone from Flash since ActionScript 2.0 in Flash MX... I'm coming back to Flash, and I notice there's a number of IDE's (some of which cost more than the Flash upgrade). So... question for Flash/Actionscript 3 developers -- which IDE to use, if at all? Hands down, definitely use an IDE for ActionScript. We use (and I recommend) Flash Builder 4. ActionScript 2 In older versions of ActionScript (like Flash MX that you're familiar with), an IDE was not as important. You could get away with most coding in the Flash Development Environment. In those

What is faster plain objects or strongly typed objects in actionscript?

蹲街弑〆低调 提交于 2019-12-01 22:49:14
So is public var user:Object = {}; user["firstName"] = "Bill"; user["lastName"] = "Cosby"; slower than if I have a value object like User? var user:User = new User(); user.firstName = "Bill"; user.lastName = "Cosby"; public function speedTest():void { var typedObjects:Array = []; var dynamicObjects:Array = []; var typedObject:User; var dynamicObject:Object; var i:int = 0; var n:int = 10000; for (i; i < n; i++) { dynamicObject = {}; dynamicObjects.push(dynamicObject); typedObject = new User(); typedObjects.push(typedObject); } // typed var time:int = getTimer(); i = 0; n = 10000; for (i; i < n;