actionscript-3

AS3 check if class extends another class

In AS3, I'm trying to check whether an object is an instance of, or extends a particular class. Using something like if (object is ClassName) works fine if the object is an instance of ClassName but not if it's an instance of a class that extends ClassName. Pseudo-code example: class Foo {} class Bar extends Foo {} var object = new Ba...

openWithDefaultApplication fails on files in application folder

Hello I'll ONLY recieve an "Error #3000: Illegal path name" if I try to open a file which is placed inside the app-folder of the air. If the file is somewhere else outside of the app-folder it works. private var file:File = File.documentsDirectory; public function download():void{ var pdfFilter:FileFilter = new FileFilter...

Taking a screenshot of browser/tab window in flex

Hi all, I'm quite new to Flex. I've looked into taking screenshots in flex and have found many links on google and here on stackoverflow for taking screenshots of components and stuff like this. What I would like to do is take a screenshot of the entire tab in a browser window (or, failing that, the browser window itself or even just ...

How to run an EXE file from Flash/Flex/AIR?

Hi I want to run an .exe file from my Flash/Flex/AIR Application, How is it possible? What I need is to build an Interface to open a xls file and convert it into swf, I have the converter file which is an exe file, when I run convert.exe infile.xls outFile.swf. once the conversion is done, I need to show all swfs inside my Application...

Flex 3.5 / Flex 4 Strange Scaling/Positioning problem

I have a simple block of code to demonstrate an issue: package { import flash.display.Sprite; import flash.events.Event; [SWF(width="400", height="400", frameRate="24", backgroundColor="#FFFFFF")] public class sandbox extends Sprite { public function sandbox() { graphics.beginFill(0xFF0000); graphics.dra...

How to synchronize multiple video streams in ActionScript?

I'm trying to play multiple video streams simultaneously. However, I cannot synchronize these videos to play at the same rate. ---- details -------- I have three 45-second videos in FLV format and I use flash.net.NetStream to play these videos. I call netstream.play() of these netstream at the same time (by using a for-loop). However, ...

How to create Android Options Menu in Adobe AIR? (not Java)

Hello, I would like to create an Options Menu in my Flash AIR application for Android. I've figured out already, that this ActionScript code could be used for capturing the hardware Menu button press event: stage.addEventListener(KeyboardEvent.KEY_DOWN, _onKeyDown); function onKeyDown(event:KeyboardEvent):void { if(event.keyCode ...

Setting Focus on a List ItemRenderer with TextArea inside?

I've wrote a custom itemrenderer for a List component (Flex 3.5) which is a VBox with a Label and a TextArea wrapped inside. All works fine so far but I want the TextArea in the first itemrenderer to receive focus so that it instantly becomes editable when tabbing onto the List. Is that possible and if how would I achieve this? I've alr...

Custom Marshalling from Java to Flex via BlazeDS

My team are putting together a proof-of-concept Flex application sitting on top of a Spring-based server using BlazeDS. We do quite a lot of date calculations, so we use Joda Time extensively throughout the code and in our domain model. We're now trying to figure out how we can continue to use Joda Time in our DTOs that are sent back-a...

Mad-Scientist Javascript Obfuscation Idea

Hey guys, So I'm sure this is probably at least mostly insane, but I was just thinking about AS3/JS interaction and it got me wondering - does anyone know exactly how inefficient calling JS via AS3 is? For example, if you do the following: import flash.external.ExternalInterface; ExternalInterface.call("(function() { /* here's a block...

AS3 Button stops working after random amount of click

I have a movieclip being used as a button. After a random amount of clicks the button stops working. In other words, the mouse will become a hand when hovering over the button but no clicks are registering to fire the function. I've even clicked it 40 times and it will work but then suddenly, bang!, it stops working. Heres the function t...

Is it possible to make a flash based game without graphic skills? Is actionscript all I need?

If I have a designer make the necessary graphics, what do I need to learn to make a flash based game? Is it action script only? I already understand the backend server work that would need to talk to the 'front end' part of the game i.e. how the flash game will make requests to the backend servers for storing/retrieving data in xml/jso...

Does AS3 provide any way to stop a returned object being modified?

If an AS3 method returns a reference to a complex type, is there any way to make that 'readonly', like how you can have const member functions in C++? An architecture I want to use calls for a class building itself from a passed template object... and really the template object should not be modifiable. I'm currently forced to add call-b...

Best practise: Preloaders in Flash?

I'm a bit curious.. I'm working on an application that loads dynamic data externally - this can take from one second up to several minutes depending on the user's connection speed. Should I make a preloader at the start of the application and load in every data or make X preloaders and show them for every page/part of the application w...

How do I make a flash library that can be either compiled in or loaded at runtime?

Hello, I'm looking to make a library that can be either merged into a swf at compile time or loaded into a swf at runtime. The way I understand it, .swc files are generally merged into a swf at compile time, and .swf files are generally loaded into a swf at runtime. Is there a way I can have one file that can do both? ...

How do you give multiple classes additional functionality without inheritance in AS3?

I am writing a game in ActionScript where I've got multiple classes that should be "hitable" by shots. The most generic class that all other in-game entities inherit from is CombatObject; The classes CombatShip, CombatAsteroid and various others inherit from it. The classes CombatAi and CombatPlayer both inherit from CombatShip. Now I ...

AS3 Loader Class - Load Silenty & Error

Hello, I'm using the as3 loader class as follows: var l:Loader = new Loader(); l.addEventListener(Event.COMPLETE, onComplete); l.load(new URLRequest(e.target.data)); function onComplete(e:Event){ addChild(e.target.content); } But it's not loading???? I've imported the loader class, and it works without the event listener but not wi...

AS3 x and y property precision

In ActionScript 3 (and IIRC 2), the x and y properties on a display object are always stored as multiples of 0.05. so something like obj.x = 66.6666 is the same as obj.x = 66.65 Most of the time, this doesn't matter. But sometimes I can end up with really slow-moving objects, eg 1 pixel per second. 1/60 (fps) = 0.017 pixels per frame. ...

ActionScript / Flash – Add ASDoc Documentation to Adobe Help?

is it possible to add ASDoc documentation to Adobe Help application? i've configured Adobe Help to show documentation off-line only, so there is a store of the official AS3 docs on my computer somewhere, but all i can find is a helpmap.txt (800+ kb). it would be very convenient to have access to all documentation via right-click > view...

Smooth Custom AS3 Movieclip repel function

I wrote this repel function (below) for 2 movieclips and I call it from a timer instead of an enter_frame listener (speed), but it has the tendency to jerk and not be very smooth. How can I smooth the movements? I was thinking maybe adding some sort of padding or something, but idk...Any help would be greatly appreciated. Thanx :) func...