actionscript-3

Large serifs in a font cause flash to measure size incorrectly

I have a textarea where I measure the textWidth and textHeight to make sure the user cannot enter more text than can fit in the text area. I also extended the textArea with a textHeightNow and textWidthNow that measure the textField's dimensions since they update w/out requiring validation. Now this works great for 90% of the embedded ...

get keyCode from string?

Using a static method in as3, I can get a charCode from a character in a string. How can I get the keyCode from a character in a string? Do I need to run this function through javascript (if I can do this in Javascript...) ...

Flex 3 make text from 2 labels in a Hbox look like one word

I'm adding dynamically labels to hbox, and i need to remove all spaces between the text of 2 nearby labels i did horizontalGap = 0 for Hbox padding left and right = 0 for labels anything else i could do ? or maybe some other component ? here is the code <mx:HBox horizontalGap="0"> <mx:Label text="wo" paddingLeft="0" paddingRi...

How to export a datagrid to Excel file in Flex?

How do I export data in my datagrid to an Excel file in Flex? Can anyone provide some examples for that? I am browsing but couldn't find out a single example of that kind. EDIT Browsed a lot and found out how to convert datagrid data to csv format. Now How to convert that to excel? Is there a way to do that without using any server sc...

Detech event target from which position of Array

I have a loop MC which will be duplicate to stage several times according to every click. Now I want to detect if the MC being click belongs to which position in the array. private function levelsBG():void { LIST = new MovieClip(); d++; for (var i:Number=0; i<myXML.children().length(); i++) { listMC=new MovieClip(); LIS...

Flash Security Error Accessing URL with crossdomain.xml

Hello, I recently deployed a Flash application to a server, and am now experiencing errors when making HTTPService requests. I have put what I believe to be the most permissive crossdomain.xml possible in the wwwroot folder, and still get the errors. Interestingly enough, the error only seems to occur when the request is made from a d...

How do I make Flex create one-element arrays from XML data?

I retrieve XML data in Flex via HttpService. I have the resultFormat property on the HttpService instance set to HTTPService.RESULT_FORMAT_OBJECT. The result contains data similar to this: <!-- ... --> <children> <item><!-- ... --></item> <item><!-- ... --></item> <!-- ... --> <children> <!-- ... --> I get an array named item be...

Flex 3 and scaling DropShadowFilter

I have an application that requires resizing of a component that will be scaled up and down quite frequently. I noticed that when I scale the component, any filter I use on it will not scale with it. I realize this makes sense, but I was wondering if Flex had a tool built in that would allow me to scale the filter with the component. I k...

Flash Text Input Bug Firefox

I've had this bug pop up before with Firefox wherein my .swf files that contain text input fields, when typing the cursor stays in one place and only last letter I typed appears. Anybody familiar with this and know what's causing it or how I can avoid it? ...

Why is loaderInfo available only after applicationComplete fires?

In an AS3 project, we can access loaderInfo in the first line of the root class' constructor. This means that the entire AS3 application can take advantage of the loaderInfo object. However, in Flex, it seems that the loaderInfo object is not available until after the applicationComplete event is sent. This is problematic for me, as o...

How to change the thumb graphic on a Flash slider...

I have a dynamically created slider with AS3: s I can reference the thumb by s.getChildAt(1) ~ that took me quite a while to figure out! But how would I assign a new graphic to it? :-/ Hmm. ...

text matching in actionsript

Hi I have some html text coming from an rich text control. something like: <TEXTFORMAT LEADING="2"><P ALIGN="LEFT"><FONT FACE="Verdana" SIZE="10" COLOR="#0000FF" LETTERSPACING="0" KERNING="0"><A HREF="event:http://bbc.co.uk" TARGET="_blank"><U>l</U></A><U>ink1</U><FONT COLOR="#000000"> blah blah blah. another <FONT COLOR="#0000FF"><A ...

Removing multiple object from array

I place the MC in an array and would like to remove it later on from an index maybe till the end. //Removeing MC from stage, from an index till the end LISTmc.removeChild(listArray[clickedIndex+1]); //Removing MC starting from an index till the end listArray.splice(clickedIndex+1); Is the way to remove the MC from the stage same with...

Displaying multiple copies of same external image in Actionscript 3.0

I know I can load and display an external image like so: var loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete); var container = new Sprite(); container.addChild(loader); try { loader.load(new URLRequest("http://www.google.com/intl/en_ALL/images/logo.gif")); } catch (e:Error) { trace...

Main SWF preloader problems

Hi, I'm trying to set up a preloader to show the load progress of the main swf, which has all of it's assets embedded. I found the factory class method as described on bit-101, but no load progress ever seems to show. The swf loads fine, but the bytesLoaded is always equal to bytesTotal and therefore the preloader is never called. This...

List refresh, item renderer in Flex

I have a List and the item renderer displays an image and text from xml (news rss). Not all news have an image. Whenever you scroll the list, and the item renderer refreshes, it move images of news of a position, so the news "1" have the image of news "2", and the news "2" have the image of news "3" ecc., but the text (the title of news...

How to close elements the HTML-way with e4x-generated XML?

Hi all. I'm using e4x to generate a HTML-snippet for my users which they can copy & paste into their blogs or web sites: var xml: XML = <object> <param name="..."></param> <param name="..."></param> <embed args="..."></embed> </object>; var html: String = xml.toXMLS...

Are there any libraries providing mouse-driven zoom/pan for pure AS3 projects?

Today I wanted to add mouse-driven zoom and pan functionality to a pure AS3 project - something like the Google Maps interface. I was surprised that I couldn't find a good package or library to do this already - I'm using FlashDevelop rather than Flash CS3, so the nice VCam tool available as an FLA is no use. There's nothing very compli...

DataGrid-CellRenderer: Multiple colors for text

Hello folks, can someone tell me how I can manage to give single words inside a DataGrid-CellRenderer a different color than defined by the TextFormat for that CellRenderer? It's not how to get these single words, it's how to use more than one color inside one cell... ...

How to stream video over Socket Class (or XMLSocket) with ActionScript?

How to stream video over Socket Class (or XMLSocket) with ActionScript? or\and How to do it using Socket Class (or XMLSocket) in AIR? ...