actionscript-3

Lost with dispatching an Event. Appreciate any help, please.

Hello, This is the objective I have been trying to accomplish but having no luck. I have a simple swf named "btn.swf". It has a button and when it is clicked, it dispatches an Event to it's parent 'Main App'; I then wrote a CustomEvent Class which 'btn.swf' extends to. Btn.swf creates an instance of CustomEvent and dispatches event. I...

Actionscript 3: Can someone explain to me the concept of static variables and methods?

Hi, I'm learning AS3, and am a bit confused as to what a static variable or method does, or how it differs from a method or variable without this keyword. This should be simple enough to answer, I think. ...

AS3 - Tile image/movieclip along a line

If possible I would like to tile an image or MovieClip along a line using the standard moveTo() and lineTo() methods, The lines are directional so need to show something similar to >>>>>>>>>>>>>. The lines can be at any angle, so using drawRect() with beginBitmapFill() isn't an option. Also if possible I would like to have the lines anim...

ActionScript 3 accordion component child container overlay each other

Hi all, I use accordion list in as3 to display marker cluster info on google map. For some reason, the current selected child container(a vbox) is overlaid partly by the next container's label. And it seems the longer the accordion list, the bigger the area of the container will be covered. I tried to set the resizeToContent property to...

Move elements in an ArrayCollection - FLEX

Hi, Can someone lead me to SHIFT an element in an ArrayCollection in flex? I have an ArrayCollection of sorted objects. Now i need to move a row to the end of the ArrayCollection. To illustrate, arrayCollection = ["Cars","Other","Trucks"]; This ArrayCollection is sorted. Now i need to move 'Other' to the end of the ArrayCollect...

How can I get the background color of a loaded swf file ?

I'm loading an swf file into my main application using URLLoader, I want to get the background color of the loaded swf file. ( I heard that one solution wold be reading the byte code of the loaded swf ) ...

Add eventlistener If the Object property is Updated or changed in Flex3, Air?

Hi, I am working in air application , i need to know how to add event listener when any object is updated, how can i implement this. Example: i have Class name Vehicle, and child class are Car,Bus,Bikes,Scooter,..etc, child class also have many properties like color,model no,....etc I have array collection and AddChild() method in V...

Restrict MouseEvents to Mask in Flex Skin?

I have a ButtonSkin (Flex 4 Skin) with a Rect, a Label, and a Group, the Group masking the Rect. On rollOver, I animate the Label's x to this.width, and on rollOut, back to the original position. The problem is, when I rollOut, if I roll to the right (where the label is hiding behind the mask), it doesn't register rollOut, until I go p...

synthesize getters/setters in AS3

Hi, Is there a way to synthesize getters/setters in AS3? It's very common that you have a class with lots of variables, especially in math calculations (Model in MVC pattern), that you'd like to expose. Is there something like synthesize property in Objective-C, that allows to generate getters/setters? Thanks, Nava ...

Width/Height of dynamically loaded Image

I've been struggling with this problem for far to long now, and I'm guessing the solution is quite easy. In my Flex application, I've got a component that extends UIComponent where I'm loading images at runtime and try to display them. I've tried lots of different approaches (using beginBitmapFill(), using different containers), but I ...

Flex Layout overview - any way to get a component's preferred size?

Is there a good place that has an overview of how Flex layout stuff is managed? I'm trying to create some user-resizeable "windows" in Flex, but I'm having some trouble getting the layout calculations for the contents correct. Right now I'm just trying to get a good understanding of how Flex calculates its layouts, but I haven't found ...

AS3 incorrect Button dimensions

I have a MovieClip created in Flash CS4 which so far only has two textfields and a button in it. The buttons width and height are set to 60 and 22. If I select everything in Flash it confirms that the width and height of the entire movieclip is 130 and 120. The problem is when I try and get the size in AS it returns 170 and 200. After ...

How to use Actionscript 3.0 to go to a new Web Page at the last frame?

I have a SWF that is acting as a sort of intro for my site, when the intro is done playing, I would like it to go to a different site. How would I do this, and would I just put it in the actions panel of the last frame on the timeline? Thx in advance! ...

AS3 regex split

I want to split a number using regex. I have a number like xyz (x and y are single digits, z can be a 2 or three digit number), for example 001 or 103 or 112. I want to split it into separate numbers. This can be done, if I'm not wrong by doing split("",3); This will split the number (saved as string, but I don't think it makes differen...

Seek and Play video that is already buffered

I'm currently building a custom Flash player that will play streaming video from an FMS. Everything is working 100%. However, I would like to optimize the way the player seeks from one part of the video to another. Currently, anytime the seek method is used to progress to another part of the video the buffer is restarted from the time...

how to detect links in a string using RegEx in as3 ?

I am trying to find the generic links in strings. I've found a very handy regex on RegExr, in the community expressions: (https?://)?(www\.)?([a-zA-Z0-9_%]*)\b\.[a-z]{2,4}(\.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(\.[a-z]*)?(:\d{1,5})? I tried to use it and it returns null, although the same string tested on RegExr works fine: var linkRegEx:...

Embedding Fonts in AS3 - Dynamic Text Field disappears

This is hopefully a new problem or just me missing something obvious. Please help! I'm embedding a font into my AS3 application. I'm doing everything by-the-book and it half-works. In my main class, [Embed(source="Art/moolbor.ttf", fontFamily="MoolEmbed", mimeType="application/x-font")] var MoolEmbed:Class; Then late...

Actionscript Wait For Asynchronous Event Within Function

Hello, I need a little help with asynchronous events in ActionScript 3. I am writing a simple class that has two functions, both of which return strings(logic and code outlined below). Due to the asynchronous nature of the AS3 HTTPService, the return value line is always reached before a result is returned from the service, yielding an...

how can I unload a swf with AS3?

Any body can help on how I can do to unload a swf before I load the next one? var mLoader:Loader = new Loader(); function loadSWF(e:Event):void { var imageId:Array = e.target.name.split("_"); var targetId:int = imageId[0]; var caption:int = imageId[1]; txt = arrayText[caption]; dynText1.text = ""; dynText1.tex...

Getting error when trying to use stage.height to place a graphic

Hey peepz! I have this footer image, that I want to align to the bottom of the stage, however I'm getting errors. As you can see I have an ADDED_TO_STAGE listener in the constructor function. package src.display{ import flash.text.*; import flash.display.*; import flash.geom.Matrix; import flash.events.Event; public class Frame exten...