actionscript-3

Is this an efficient use of the Array.filter() method for searching and retrieving an Object instance from an Array?

I am curious if this is an okay implementation of the Array.filter() method. //Array of generic Object instances representing galleries. //The images property is empty for the example var galleries:Array = new Array(); galleries[0] = {name: 'Portraits', images: new Array()}; galleries[1] = {name: 'Landscapes', images: new Array()}; ga...

How to determine currently processed event in ActionScript?

When one call Clipboard.generalClipboard.getData() in ActionScript outside of Event.PASTE processing function it fails with following message The Clipboard.generalClipboard object may only be read while processing a flash.events.Event.PASTE event. Even if I dispatch Event.PASTE event and call this function within event handler it s...

Enter on frame or timer - which to better use for updating in AS3?

So I've about hundred of map tiles and each title has some object which does some stuff. And one of things it should do is to update text (a time after which you need to do something) in text field. How should i do it better - with enter frame event and on each enter frame update it or set up a timer object which on each second would upd...

Javascript is passing an Array of Objects instead of an Array of Arrays...

I'm passing a Javascript Array() to Flash via FlashVars but Flash complains. Can you guys point me what am I doing wrong here? javascript code // array with the user defined cities var usercities = new Array( {'nome':"London", 'lat':51.5002, 'long':-0.1262 }, {'nome':"NYC", 'lat':51.5002, 'long':-0.1262 } ); flashvars.newcit...

Using img tag in an AS3 TextField without width and height attributes

I'm attempting to load HTML from the Shopify blog API into a TextField in Flash. The problem is that Shopify doesn't add width and height attributes to images that are in the blog posts. When I load these into Flash, the width and height of the image is ignored and the height of the TextField is incorrectl, which screws up my scrollbar a...

Server-side Actionscript 3 Image Processessing

I have an as3 project that lets a users create labels for jars and containers (think t-shirt editor) using custom images and text. To send them to the printer as pngs, I create a Bitmap object and use a scale matrix and they come out perfect. There is, however, a 2-14 sec lag between building the bitmap, sending it to the php service...

How to do this XML declaration in Flex4

I have a dataProvider that's defined with mx:XML like this. <mx:dataProvider> <mx:XML format="e4x"> <root label="All Items"> <morning label="Evening" type="check" /> <evening label="Evening" type="check" /> <night label="Night" type="check" /> </root> </mx:XML> </mx:dataProvider> This do...

help, losing extension when use FileReference download

Hi, All I need user download JPEG file from my app, however, when user change the file name the saved file will be downloaded without extension. For Example: I am using FileReference.download() and set the default filename as "demoPic.jpg" and user's windows system setting control file extension not being shown. So when the dialog open...

Using AS3, should I declare variables globally or within a function only when they are needed?

I am working with URLLoader and URLRequest in this case. I have two buttons. One listens for the mouse click event and then runs the following function (less code not applicable to this question): function loadURL (e:MouseEvent):void { .... var myRequest:URLRequest=new URLRequest("*URL*"); myRequest.method=URLRequestMetho...

AS3 functions and accessing variables

I'm trying to create a JW player plugin, a part of the source code is shown below: public function initPlugin(player:IPlayer, config:PluginConfig):void { api = player; var streamUrl:String = 'xxx'; var streamSecret:String = 'xxx'; var xid:String = config['xid']; var request:URLRequest = ...

Saving several images (and metadata for each) in a single file using Adobe Air

Is it possible, via Adobe Air, to save multiple types of data in a single file? For example, an application would allow the user to load in external images, position them on stage and label them. This data would be then be stored in a ByteArray (I guess) using BitmapData for the images and probably XML for the metadata. I would then lik...

Flash radio button label with in movie not disappearing

Hi all, I have a radio button with a label that is inside a movie-clip. When I hide the movie with an action-script tween to alpha 0, the radio button disappears but the label remains. I am pretty certain this is to do with embedded font, but can't seem to get the answer. When I try: Questions.RBMusic1.setStyle("embedFonts", true); ...

AS3 Loading a MP3 into a ByteArray and then into a Sound?

Hi guys, I was wondering if there are any good workarounds to load a MP3 file into a Flash app but not via the Sound class but as a ByteArray via URLLoader and then give it to the Sound class play playback/etc.? I know about this workaround http://www.flexiblefactory.co.uk/flexible/?p=46#more-46 ... basically wrapping the loaded MP3 dat...

programmatically skinng the roll over idicator of a flex list component

Does anybody know how to add custom rolloveridicatorskins to a flex 3 list component? it doesn't have the rolloveridicatorskin in the css. ...

AS3 a way to get TextField current size?

Hello everyone I was wonder if anyone knew a way to get a textfields current size? ...

AS3: indexOf() sub-array in a multi-dimensional array

var asdf:Array = [ [1,1] ]; trace( asdf.indexOf( [1,1] ) ); // -1 Why can't indexOf() find the [1,1] array? ...

Is there some way to force 'updatedisplaylist' immediately rather than at later some point.

In flex component life cycle, after we make some change in a components property, invalidation methods schedules a call to methods like commitProperties, updateDisplayList, etc for some later time. I need to call the updateDisplayList instantaneously. Is there some direct way to do this. Currently, both the labels are changed simultane...

Difference between RemotingServices, WebServices and HTTP in Flex.

Dear friends, We use 3 types of services in Flex; HTTP, Remoting and WebServices and would like to increase my understanding about their use cases. As far as I understand, Remoting can be used only in homogeneous environment like Flex-RubyOnRails (through RubyAMF) while Webservices can be used in Heterogenous environment using SOAP pr...

[FLEX 4 / AS3] I load a new component in a as3 file and I want to pass to it some data, knowing only it's a IVisualElement.

[FLEX 4 / AS3] I load a new component in a as3 file and I want to pass to it some data, knowing only it's a UIComponent. ex: // class1 // ... _UIClass = getDefinitionByName(_basePath + _UIPath + '.' + _UIName) as Class; _UI = new _UIClass(); // UI is a IVisualElement // _UIClass is a Class, and in practice is a reference to the compone...

Facebook login within Flash without popup or redirect?

Does anybody know how to handle a Facebook login from within Flash using REST API/FB Connect, without the popup or redirect? It doesnt seem very possible as the login method seems to force the popup. Might it be possible by modding the code to have it load in an unseen iframe (i.e. navigateToURL(new URLRequest("http://www.facebook.co...