actionscript-3

Dynamic Classes in AS3?

Below is a sample: private function loadLevel(name:String):void{ level1 = new Level1(name); level1.onInitialize.addOnce(onLevelReady); level1.loadData(); } Loads only level1 class, now I dont want to create another function just to load another level.. I want that loadLevel to load ...

collision detection in actionscript using bitmap.hittest

Okay so I have two png files, a circle and a maze. Basically the maze is a square with some paths carved through it. I want to draw these images, move the circle to the mouse coordinates, and have a text say 'hit' when the circle intersects a wall of the maze and 'miss' when it doesn't. Now I want to do these using the bitmapdata.hittest...

Actionscript 3 loading external swf casting issue

Hi all, I'm having something of an issue with trying to load externally defined classes in actionscript 3.0. I believe this to be an issue with my understanding of the ApplicationDomain / LoaderContext classes, but even after going over the documentation and a couple of web searches I'm still stuck. Essentially what I want to do is load...

flash.utils.Dictionary mechanism

The dictionary use strict equals(===) for key comparison, how to change the comparison, so I can use my standard for comparison, for example, I have a class named Student: class Student{ var id:int; var name:String; var age:int; //constructor Student(id:int,name:String,age:int){ this.id = id; ...

MD5 Hash in C# doesn't match MD5 Hash in Action Script

Hi, I'm hashing some data in Action Script then comparing the hash to one computed in C#, but they don't match. Anyone know why? Here's what I do in Action script: var hash : String = MD5.hash(theString); And here's what I do in C#: var md5Hasher = MD5.Create(); byte[] data = md5Hasher.ComputeHash(Encoding.UTF8.GetByte...

alert dialog not showing the text in flex 4

Hi, I am using Flex 4 and running into some problems displaying a simple alert box. The alert box shows up, but the text seems to be the same color as the background. I know the text is there because if I mouse over in the alert box window to roughly where the text would be, I can see the cursor change. And when I double click and copy-...

How to read JSON using Flash

To read JSON using as3, are there any built in methods? It would be better if we get some code samples ...

flash/actionscript to display an image for x seconds

Is there any opensource flash/actionscript code to display an image for x number of seconds. ...

Click Flex 4 spark ToggleButton component in code

I can't found any property in sparks's ToggleButton that allow me to press it from code. I tested setCurrentState("down") method, but this way button not dispatching click event i think. ...

first value should be selected when loading the data in ComboBox

Hi, I had a comboBox and loading the datadynamically from the server. i need to display the first value in comboBox as a selected value and based on the value data should be populated on the grid. Please send me a sample example on the same if nay one knows. thanks, Ravi ...

scrolling interval in a Spark List with Tilelayout oversized while using mouse wheel after scrolling with mouseclick

I have a spark List with an item renderer and a tile layout. If I scroll by clicking with the mouse on the scroll bar and trying to scroll with the mouse wheel after that, there is a problem: The interval of the scrolling is oversized, instead of scrolling one item down (or up) the List scrolls 4 items down (or up). <s:List dataPro...

The problem with alpha channel MovieClip (Actionscript3)

Here is my code: var menu = new Menu (); menu.x = 0; menu.y = 0; addChild (menu); menu.alpha = 0; TweenLite.to (menu, 10, (alpha: 1)); This works, but transparency varies for each element MovieClip separately, but I would like that would have changed the whole MovieClip transparency as a single image. Menu(); is generated from XML. ...

Is it possible to embed flv file in to flash?

Is it possible to embed the flv file in to the flash like other files(images, swf), so that i can handle this in as3 as programmaticaly in the same way as FLVPlayback component? I know the way to add flv file by creating FLVPlayback component. But in this case we always need to depend on the source path of corresponding file. I am not ab...

Override Clone() in custom event for AS3... need help

I have created a custom even class which is pretty basic. But when calling an event and then relaying that event to another class I have encountered the "cannot transform thisEvent into thisOtherEvent" error. I realize this is because I needed to override the Clone function in my custom event like so: package com { import flash.dis...

As3, bitmapdata.hittest collisions with opaque/transparent png files imported with loaders.

Simply put: I have two png files. I import them using loaders. The images in the png files each have opaque (solid) and transparent parts. I want to use the bitmapdata.hittest method to detect when their opaque parts have collided. Sadly I have not gotten this to work at all yet... This is my code: package { import flash.displa...

Issue with fullscreen viewing in Flash - very odd !

Hi All First just want to say thanks so much to those who answer and dedicate time to helping newbies. I for one am very grateful and hope I speak for many others. All the answers I get here either solve the problems or lead in the right direction And speaking of problems …. Please see http://simplywebdzine.com If you click on a thumbn...

Loading data (HTML) from external domain into Flash Actionscript 3

I'm trying to load HTML/CSS from an external domain into a SWF using Actionscript 3. The data loads properly when I "test movie" out of Flash. However, when I upload the SWF to the website, it will no longer import the data. Here is an example of my code... import flash.events.MouseEvent; var req:URLRequest = new URLRequest("http://w...

How do I call this function so that it uses the default parameter value?

slice() method AS3 function slice(startIndex:Number = 0, endIndex:Number = 0x7fffffff):String String:slice() doc The documentation says the default value of startIndex is 0, How do I call this function so that it uses the default value of startIndex? ...

Creating Classes and Properties in AS3

I'm new to AS3. Learning how to create classes. Is comp = new HouseObjects creating a new class? Is comp creating an instance of the HouseObjects? I realize that this is inside public class TreeHouse. I'm thinking that HouseObjects, how I set it up is not a class...not sure what the correct way to set up classes and properties. Also I n...

What's an awesome formatter for MXML/AS3?

I want a Flash Builder plugin that takes ugly unformatted mxml and makes it beautiful +1 if you would like something like this also. Edit: noticed that screenshot is barely legible. Larger version here: http://dl.dropbox.com/u/672147/mxmlFormatterDream.png ...