actionscript-3

How to save locally user data in AS3, and then read it/export it?

Hey there, i was wondering what the AS3 experts would do to perform this task: save user data (registry form) locally, and then be able to read it or export it into something client can read. Thanks in advance, i am quite new to the AS3 approach to this things, thing to notice is this project is pure AS3, and deployed in Adobe AIR, so n...

How do I handle a custom event in ActionScript 3?

Hello, I've created an Event Handler/Listener like so: import flash.events.Event; public class DanielEvent extends Event { public var data:*; public static const APP_STARTED:String = "APP_STARTED"; public function DanielEvent(n:String, data:*){ this.data = data; super(n) } } Listening to an event us...

AS3/Flex 4: Most Practical Way To Find Nested Children

Hey guys, I'm sort of jumping in headfirst to some Flex/AIR stuff. I have a pretty solid background with AS3, but given the inherent hierarchal complexity of Flex (compared to regular Flash), I'm running into an issue. Let's assume that you have an app where pretty much everything is event driven (common). Accessing elements in the n...

xOr'ing Two Images Together Using Actionscript 3.0/Flex

Isn't there some way to combine two images together using the xOr operator? I realize I can step through pixel by pixel, but with all the graphics options available to Flash, I am reluctant to take such a ham-fisted approach. How can this be accomplished efficiently? var pixel1:uint; var pixel2:uint; var xorMergedPixel:uint; for (var ...

Actionscript 3.0 gesture tracking

I am creating an interactive animation of a cat you can stroke, rub, poke etc. I have implemented some basic functions in an attempt to recognize the different gestures, I am using the mouse down and mouse up events to track the duration and distance of the click. My problem with this is that the 'distance' is measured from the start p...

Acceleration and Deceleration in AS3

Hi Guys, In my Flash File I have a wheel. The user is able to rotate the wheel by using arrows to jump to the next "segment" (think 20 images attached to each other forming the circumference of the wheel). Clicking the arrows initiates this code: protected function rotate():void { var rotateTo:Number = (-360 / num...

Comparison of Flash 3D Engines

Hi, I am currently digging into the whole Flash 3D stuff and I am quite unsure which engine I should use. I really prefer haXe for development but ActionScript 3 is also fine. Therefore I would like to ask you about experiences you have made! If you answer this question please consider the following points: Easy to use? Easy to learn...

buttonMode and useHandCursor property in DataGrid doesn't work

Set proprty of "buttonMode" and "useHandCursor" to true in DataGrid, it does not work as I expect. Only move the cursor to the edge between two rows, the hand cursor can show. What I expect is that no matter where the cursor is moved, it should always show hand cursor following is one of itemRenderer: <?xml version="1.0" encoding="utf...

Can Adobe Air do this?

I've written a lot of JavaScript before, and adobe air looks really interesting, my question is can Adobe Air: Access ICC profiles stored on a users computer Detect which ICC profile the monitor is currently using Use the SDK for specialist USB hardware Do all this one both Windows and Mac computers Thanks for any information. If no...

Which is efficient: Switch, If or function?

I will need to handle a piano key that can respond as fast as possible without high CPU load with repetitive key press and release on virtual piano in Flex application. Is calling function much effective or Switch? Example: switch(keyNote) case 'c4': keypress.button=down; case 'c4': keypress.button=down; case 'c4': keypress.button=do...

AS3 quick and efficient way of removing children and listeners and discarding the parent

Is there a fast and efficient way of removing all children listeners etc from my app. If everything is contained in a display object on the stage called View? I have lots of dynamically called children and their listeners do not get removed when I remove the View they reside in. public function _discard ():void { // Quic...

Framerates in Flash/Flex apps

In MXML-based apps, you set the target framerate for the app and I believe this is a core part of Flash as well. Two questions... In many games you want the game to run as fast as it can for graphical smoothness, with some upper cap like 50-100Hz. How can you have variable framerates in Flash, or is it really not how things work? What ...

Dispatch Flash Event when person closes browser

I have an RTMP stream loading and would like to know the drop off time of the video. Is there a method of knowing when a person abruptly leaves the video session by closing the window, back button, address bar, etc? Or do i need to make an external interface call from JavaScript to Flash using something like onunload & onbeforeunload ev...

actionscript dictionary contain function

I want to initial all states such as c4.currentState='down' so that I could call dictionary key to execute the function, is it possible? private var keyMap:Dictionary = new Dictionary(); private var c4v1:Object = new Object(); private var c4v0:Object = new Object(); private function initial_keyEvent():void { keyMap[c4v1] = "c4.cur...

Can't "removeChild" after referencing the object earlier.

Basically, I have two routines: One is a CDK collision check, and the other is a generic verification of an array. They're both inside the same Timer Event. There are two arrays - the collisionList and the MasterArray, and the object is in both of them. First, the collision routine: var collisions:Array = collisionList.checkCollisi...

Actionscript 3 IDE

Hello, I'm currently using textmate with the actionscript 3 plugin to get as3 compile support. I'd like to use flash develop though, as it comes with much more, including code suggestions. Is there any free and/or opensource alternative to flex builder/flash builder 4 that runs on a intel Mac? ...

What is the best approach to building a popup inside of Flash AS3

I am trying to accomplish an "imagemap" in flash where you click on different areas in the image and when you click on it, a popup (within flash) comes up showing more information about the object that was clicked on. The popup has a close button that can will then close the popup. My biggest trouble is the way I have my code right now...

AS3/Flex 4: Easing via AS3

Hey guys, This is probably something simple but I'm scratching my head over easing with the Animate class in Flex 4. Basically I'm just trying to set easing via: anim.easer = spark.effects.easing.EaseInOutBase(EasingFraction.IN_OUT); however, it complains, saying Type Coercion failed: cannot convert 0.5 to spark.effects.easing.Ease...

Convert serialized string from PHP to array in AS3.0

Hi there I'm busy communicating with my Flash file with a PHP script which in turns communicates with my db, I need to pass an array from PHP back to Flash, which happens correctly I assume, but I'm unable to unserialize the string correctly when it returns, my string looks like this: memberNum=2&success=1&teamMemberID%5B0%5D=1&teamMem...

Rollercoaster game with ActionScript 3

I'm trying to simulate a rollercoaster game with ActionScript 3, but i don't know exactly if I should use a 2d engine (like Box2d) or do it from scratch. For any of those I would like to see some code example. Any ideas, pointers, suggestions... Thanks in advance! ...