actionscript-3

AS3 dynamically attach MovieClip from a library to the Stage

若如初见. 提交于 2020-01-05 19:36:31
问题 I really have searched high and wide and i'm starting to think it may be my terminology that is preventing me from finding the answer. I have a MovieClip in my library set to Export to ActionScript 3.0 with a Class called 'Info_Win' (its basically going to be a pop-up window, the contents of which depends on it's instance name). I will be adding a given number of these MovieClips to the main stage and each one has to be given a custom instance name that will allow me to access it once it's on

Flex: Tree component: keeping state when data provider updates

二次信任 提交于 2020-01-05 16:25:55
问题 How would I go about keeping the state of a tree control? I'd like to keep the state of the tree when it's data provider gets updated, instead of it collapsing. 回答1: How about something like this : var openItems:Object = tree.openItems; tree.dataProvider = myNewDataProvider; tree.openItems = openItems; tree.validateNow(); I'm not sure how well this will work if the new dataProvider is radically different from the old one, but it works when you're lazy loading tree nodes. 回答2: Here is how I

Flex: Tree component: keeping state when data provider updates

£可爱£侵袭症+ 提交于 2020-01-05 16:24:27
问题 How would I go about keeping the state of a tree control? I'd like to keep the state of the tree when it's data provider gets updated, instead of it collapsing. 回答1: How about something like this : var openItems:Object = tree.openItems; tree.dataProvider = myNewDataProvider; tree.openItems = openItems; tree.validateNow(); I'm not sure how well this will work if the new dataProvider is radically different from the old one, but it works when you're lazy loading tree nodes. 回答2: Here is how I

Bookmarks in Flex

本秂侑毒 提交于 2020-01-05 14:12:26
问题 Is not it possible to add a flex url to bookmarks. If not,Please let me know if any alternatives are there. Thank you. 回答1: There is a concept in Flex called deep linking. You can read all about it in the docs. You basically just need one class: the BrowserManager. This class allows you to: control the navigation history of your browser set window titles for different states of your application set specific URL's in your browser's URL bar for different states of your application listen for

AS3 try/catch out of memory

落花浮王杯 提交于 2020-01-05 13:24:19
问题 I'm loading a few huge images on my flex/as3 app, but I can't manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont know what to catch): try{ images = new Array(frames); for (var i:uint = 0; i < frames; i++){ imagesBA[i] = new BitmapData(width, height, false, 0x000000FF); } } catch(error:????){ Alert.show("Out of memory!"); } Any idea what ???? can be? Or does anyone knows how to catch when there is no memory

flash crash when loading external swf (with code example this time around)

♀尐吖头ヾ 提交于 2020-01-05 13:09:10
问题 This is a AS3 project created in FlashDevelop. It targets flash player 10. I have a disturbing problem when running this code: package { import flash.display.Loader; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; public class Main extends MovieClip { private var loader:Loader; private var sprite:Sprite; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function

flash crash when loading external swf (with code example this time around)

我只是一个虾纸丫 提交于 2020-01-05 13:09:07
问题 This is a AS3 project created in FlashDevelop. It targets flash player 10. I have a disturbing problem when running this code: package { import flash.display.Loader; import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.net.URLRequest; public class Main extends MovieClip { private var loader:Loader; private var sprite:Sprite; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function

ReferenceError: Error #1008 Class is ambiguous

时光毁灭记忆、已成空白 提交于 2020-01-05 13:06:10
问题 I have a As3 file and I get a runtime error: ReferenceError: **Error #1008**: Tooltip is ambiguous; Found more than one matching binding. I have a class named Tooltip and also a symbol in library with linkage class: Tooltip and Base Class fvg.Tooltip (fvg is the name of the package). Why I get this conflict? 回答1: Fixed! I had to import the Tooltip class in my Document class file. 来源: https://stackoverflow.com/questions/2446183/referenceerror-error-1008-class-is-ambiguous

Flash CS5 Displaying Different “screens” on the stage as movieclips

北城以北 提交于 2020-01-05 12:14:31
问题 Taking this thread to the next level and now making a Main.as class to display different "screens" of my game. For right now I only have 1 screen called ControlPanel, but this will eventually have multiple levels (each level will be a separate screen) and a level selection screen, etc. added. So at this point I'm losing control over how to give things access to the stage (in other words... it's getting really thick with multiple levels and this noob's brain is being overloaded lol). To start

Flash CS5 Displaying Different “screens” on the stage as movieclips

℡╲_俬逩灬. 提交于 2020-01-05 12:14:19
问题 Taking this thread to the next level and now making a Main.as class to display different "screens" of my game. For right now I only have 1 screen called ControlPanel, but this will eventually have multiple levels (each level will be a separate screen) and a level selection screen, etc. added. So at this point I'm losing control over how to give things access to the stage (in other words... it's getting really thick with multiple levels and this noob's brain is being overloaded lol). To start