actionscript

How can I create a reflection effect with bitmap images in Flex?

I'm looking for a simple, clean and memory-efficient way to create and apply a reflection effect (you know the one, popularized by the famed iPhone UI) to the bitmap images I've loaded into a Flex app at runtime. The source images will be of varying types (JPGs, PNGs, etc.), but an acceptable solution can assume each image is already lo...

Why does Actionscript 2.0 have unpredictable output here?

Hi guys, I'm doing some work in Actionscript 2.0 for the first time in a while (really simple stuff, just pulling content from a text file), and I can not fathom for the life of me why I'm getting such unpredictable output here. Sometimes when I test build a simple script like this, variables are listed as undefined, and sometimes the...

Actionscript Error #2044: Unhandled SecurityErrorEvent:. text=Error #2047: Security sandbox violation: LocalConnection.send: 127.0.0.1 cannot access

When running flash components that use localConnection within an HTML container, I get the following error in a popup box (flash player is the debug version): Error #2044: Unhandled SecurityErrorEvent:. text=Error #2047: Security sandbox violation: LocalConnection.send: 127.0.0.1 cannot access ...

ActionScript2 performance: Iterating over object attributes

Is there a performance hit when iterating over object attributes vs. iterating an array? Example, using objects: var x:Object = {one: 1, two: 2, three: 3}; for (var s:String in x) { trace(x[s]); } Vs using an array var a:Array = [1, 2, 3]; var len:Number = a.length; for (var i:Number = 0; i < len; ++i) { trace(a[i]); } So - whic...

Compc (Actionscript Library Compiler) Doesn't Fail Unless I Delete the File First?

Here's the scenario: I run compc on a source directory to recompile an already existing library after some changes, which completes successfully. Then I remove the library (the .swc file) and re-compile, which causes many errors to be thrown. Nothing changed in the interim - clearly this should have either succeeded both times or failed...

How do you stop Copy/Paste in a flash form

I work for a medical transcription company and our medical transcription test we administer to our applicants is an older flash forms app that stops copy and paste by emptying the clipboard when you enter the form. This worked great in IE 7, but recently it has come to my attention that it does not work so well in Firefox. Or perhaps it ...

Where are the short-circuiting operators in ActionScript/JavaScript?

Like VB has operators AndAlso and OrElse, that perform short-circuiting logical conjunction, where can equivalent operators be found in JS / AS? ...

Does ActionScript 3 require an error event handler for XML?

In a Flash game I am developing, there are some settings that are set by an external XML file. When I run the SWF file through the Flash IDE, it loads fine. If I run the same file as a projector (.exe) or the independent SWF file, it does not load the XML file. My (unexpected) fix was to assign an error event listener to the loader ob...

When handling a flash.events.MouseEvent, how do I find the localX/Y with respect to the currentTarget?

I have a component which draws a grid of things and I want a small highlight square to follow the mouse around highlighting the square that the mouse is currently over. The whole grid is basically just one big sprite (it's a very large grid and this was faster than using pre-existing components) and the highlight square is another sprit...

How do I enable autoresizing for a Flex UIComponent?

I have a class which extends UIComponent and draws directly onto a Sprite contained within. Currently I'm (probably incorrectly) listening to the Event.RESIZE event and drawing the contents when the width and height are non-zero. The problem is that even though I've passed percentage widths to the instance tag, it doesn't appear to be re...

What is the best practice for changing view states?

I have a component with two Pie Charts that display percentages at two specific dates (think start and end values). But, I have three views: Start Value only, End Value only, or show Both. I am using a ToggleButtonBar to control the display. What is the best practice for changing this kind of view state? Right now (since this code was in...

Understanding / Modeling formulas from Excel.

I have an excel spreadsheet that performs many calculations based on 4 cells to come up with a certain figure. I have been tasked to convert this spreadsheet to a widget like component that can be embedded into a web application. Is there an easy way to display or understand the embedded formula's in the excel spreadsheet, so that I ha...

ActionScript 2, list of nested movieclips

Hello, has anyone ever tried to get the list of all the movieclips (even the nested ones) that are on Stage at a specified stopped (and current) frame in Flash 8, AS 2? I did the following: for(i in _root){ if(typeof(_root[i])=="movieclip"){ trace(_root[i]);} } But this is good for a first level search: that is, if inside the moviec...

How can I change the color of a substring of a LinkButton's label in Flex 3?

I'm trying to figure out the most elegant way to change the color of just one character of the label on a LinkButton control. Given something like this: <mx:Style> myLinkButtonStyle { textRollOverColor: #FFFFFF; } </mx:Style> <mx:LinkButton label="My Label" styleName="myLinkButtonStyle" /> ... what'd be the most a...

Flex Tree Node Naming question...

I have a tree in flex built from an XML document into an XMLlist In the XML the tags are all different and have a bunch of attributes each, and are not consistent. When I publish the file I want the name of the folders in the tree to be the tag. It is easy with attributes.. "@id" or something similar, but I can't find what it could be...

Saving MovieClips and ActionScripts - Flash Shared Objects LSOs

I know its possible to save an object (and all subclasses, arrays, strings) into a Flash LSO, locally to a user's computer. Is it possible to save a MovieClip or a Function? I tried once with MovieClips, but it just stored the reference (pointer) to the MovieClip into the LSO and therefore it was unable to retrieve the whole MovieClip ...

Partially loaded XML in Flash

In Flash it is possible to read XML data as the XML File loads? i.e. reading the partially downloaded XML string as the rest downloads, so we can process it as quickly as possible. Do you get an event that fires everytime small chunks of data downloads? like with URLLoader? Do you get access to the raw string since partial XML cannot b...

Flash - Change the CDATA end character?

Since I want to store raw binary streams in CDATA Sections of XML files, the 3 character CDEnd code might mistakenly match my binary. Any way to change the CDEnd code for Flash? I'd like it 10 char just for reliability. ...

Flash server-side Shared Objects - LSOs

The Adobe docs (I can't find which) state that Flash can read Shared Objects (.SOL files?) off a server. This could be an interesting way to store data and retrieve it client-side. Any ideas on how to do this? ...

flex 3 webservices

hi, im using the webservice component in my flex app but find im using the same code over and over again when using the same webservice calls through my app. Are there any best practices for creating webservice components? Should i be putting all the code in an actionscript class and if so have you any samples? ...