actionscript

How to translate such AS3 class into C#?

So I try to create opensource C# project for slicing FLVs I began with translating of existing project called flvslicer Can any one please help me with translating one of their classes package org.bytearray.video.events { import flash.events.Event; import flash.utils.ByteArray; public final class MergedEvent extends Event ...

Generic way to handle exceptions between JavaScript and Flash?

Hello all, I am currently using the ExternalInterface to communicate between JavaScript and Flash. I need throw exceptions from Flash that JavaScript has to interpret. I know you can receive and handle exceptions in JavaScript but I was wondering if there were some kind of built-in generic way to handle exceptions, so I could use someth...

XML As XMLNode in Actionscript/Flex

How do I get the root node of an XML object in Actionscript? One would think that I could say this: var Node:XMLNode = XMLVar as XMLNode; But although XMLVar is of type XML, Node will = null. So how do I do it? ...

Actionsript/Flex String replace for <

I have a string like "My <color>" I want to replace "<color>" with "Orange". I did str = str.replace("<color>","Orange"); but it doesn't work. How to do it? ...

What is the best way to make a game timer in Actionscript 3?

I have built an online game system that depends on a timer that records how long it took a player to complete a challenge. It needs to be accurate to the millisecond. Their time is stored in a SQL database. The problem is that when I use the Timer class, some players are ending up getting scores in the database of less than a second. (w...

Check if clicked element is inside of IVisualElement (parent)

Hi, I'm trying to check if a clicked element is inside of an IVisualElement in Flex 4. So I want something like "if this element is in this element, then execute function". I'm aware of the 'parent' property but this doesn't seem to work when my element is not a direct child of the element but for example 3 levels deep. Can anyone he...

How to get a bytearray from file stream in Adobe AIR?

I read limited (small - 15 - 500 mb files). I need to be able to put all file bytes into one single bytearray. So I have a function: [Bindable] public var ba:ByteArray = new ByteArray; //.... code ....// protected function fileOpenSelected(event:Event):void { currentFile = event.target...

Flex 4: Loading XML into a Model Actionsript Class

I'm trying to create an actionscript class to serve as a data model for my Flex app. I already have a formatted XML file to read from, and when I was simply declaring the data service in my MXML app I used this code inside the declarations: <fx:XML id="xml" source="datapoints.xml"/> I'm now trying to create a model class and can't se...

Creating a function within a loop (pointers?)

Im trying to create a simple loop that creates 50 buttons, adds them to screen and then when a button is pressed, it traces out that number. I can get it to work by doing stuff I consider hacky (such as using the buttons X/Y location to determine its value), but I'd rather just be able to hold a single value in the function. The code it...

Generating Source Info For Flex BitmapData.

Instead of populating the BitmapData class from an IMAGE. I would like to (within Actionscript) GENERATE some new BitmapData by capturing the Bitmap representing say, a TextArea component on the stage. In other words, sort of take a "screen capture" or "screenshot" of one of the components, and convert that into an image. Am I silly t...

Adding Radio button to Calendar in Flex 3

I'm trying to make a Calendar which can have radio buttons embedded in specific dates, which will be chosen by making a service call, but that's not a problem. I have had two approaches to it so far, one could be taking a datagrid, and making it a calendar, and then placing the radio button inside the cell using an item renderer. The sec...

Getting a key in the ActionScript Dictionary

Hello, I am using a Dictionary in ActionScript as a queue, sort of, still reading most of the time as an associative container, but I need one time to make a loop to run through the whole dictionary, such as for (var key:String in queue) . Inside this for loop I perform some actions on an element and then call delete on that key. My is...

Incorrect signature - Flash Facebook API [Please Help]

I've spent an entire day trying to figure out how to make this error go away: Incorrect signature I'm using as3 for my a flash file, which is embeded in iframe canva. I can connect properly: this.fbook= new Facebook(); var webSession:WebSession = new WebSession(api_key,secret_key, session_key); fbook.startSession(webSession)...

use AMF instead of JSON on iPhone? (for web services)

Although iPhone support JSON natively, AMF is a binary protocol and it supposes to use much less bandwidth. Do you think using AMF is a good idea? Just found this AMF library in cocoa (Objective-C): http://github.com/nesium/cocoa-amf/ Here's the famous benchmark that shows AMF is smaller and faster than JSON + gzip in Flex: http://www...

Sharing variables between mxml components

I have several mxml components in an app, all of which need the same variable called genericX. I've included that variable in the main mxml and made it public [Bindable] public var genericX:Number = 102; but I still can't access it from other mxml components. If I try to do this for example, it doesn't recognize the variable. <s:But...

Actionscript 2.0 Functions problem and somewhat "global" variable

I have two problems. The first problem is with the following functions; when I call the function in (enterFrame), it doesn't work: onClipEvent (load) { function failwhale(levelNum) { _root.gotoAndStop("fail"); failFrom = levelNum; } function guardSightCollision(guardName, guardSightName) { if (_root.guardName.guardSightName....

Passing URL from a XML file into SpringGraph Flex Component.

Hi all, As above, i'm trying to pass a URL in a XML file into the SpringGraph Flex Component. The SpringGraph Flex component is the work of Mark Shepherd, which can be found here. Kudos to Mark! ...

How to turn bytearray into IList in Actionscript?

How to turn Array (like Camera.names) into IList (for for ex MXML s:DropDownList <s:DropDownList x="113" y="121" selectedIndex="0" dataProvider="{Camera.names}"></s:DropDownList> )? ...

Flash video plays well, but time and time-remaining are out of sync.

Hey guys, Could be a known issue, an issue with my code or an oversight on my part. I have created a video player in flash. I have got it playing progressive and streaming over rtmp/rtmpt so that is all fine. My only issue is that when the video's are playing, the time-codes for time played and time remaining are not synced. So, if m...

Loading a symbol of type Graphic from library with Actionscript 3

Inside Flash, I have a symbol with type graphic in my library and I want to add it to stage using Actionscript 3. Is this possible? Flash does not let me set any Linkage Properties for Graphic symbols. How do I draw stuff in Flash and be able to create multiple instances of that stuff at run time without using MovieClip? Thanks. ...