actionscript-3

Attaching .swf assets to Flex3 by calling getDefinitionByName()

Hello! Does anybody please know, how could you attach symbols from an .swf file in the Actionscript part of your Flex3 file? I've prepared a simple test case demonstrating my problem. Everything works (there are icons at the 4 buttons, there is a red circle) - except the getDefinitionByName() part. My target is to attach a symbol fro...

getCharIndexAtPoint() equivalent in Spark RichEditableText

I want to find a way to get the character index in a Spark based RichEditableText based on mouse x, y position. The mx.controls.TextArea has a protected getCharIndexAtPoint() method but I can't find an equivalent of this in the Spark RichEditableText which is disappointing. Any ideas or recommendations? ...

How can I get the size of a remote file before I start downloading it?

Hi guys,I need to figure out the size of a remote file before I download it.And I know that in local place this can be done as follows var _filePath:String = "X:/save/abc.exe"; var file:File = new File(_filePath); if (file.size > 1000) { trace("too large"); } But when I tried a remote file like var _filePath:String = "http://www...

Is there a Watch list in Flash CS4's AS3 debugger?

Is a watch list hidden away somewhere in the AS3 debugger in Flash CS4? Sorry for asking a simple question like this here - I did spend a while looking around the net first. It's much easier to find the watch list in the AS2 debugger. Thanks, Dan ...

Action Script - how to access label component defined in mxml file within action script class method?

I have a label component in a mxml file like below <mx:Label x="700" y="409" text="Label" id="lble" width="131" height="41"/> if i want to access it and change its text content within a method defined in action script class that i have written, how to do it? lble.text="test"; ...

to add textfield in an array to movieclip in as3 flash

I want to add array containing textfield to movieclip and the following statement doesn't work for loop { myMov.addChild(myArray[i].person); } person is the xml node and xml has root employee and nodes person and content in CDATA Hope someone helps! Thanks in advance! ...

AS3: Netstream - cache movie in browser

I wanna play a couple of movies in a loop with netstream, and I want all of them to be saved in the browsers cache or on the users disk to maximize the performance. Can't find any information about this (my google skills sucks!!) Anybody knows? ...

TypeError 1009, XML and AS3

My animation is advanced forward, but it's frozen. It throws a TypeError 1009. How do I get rid of this error and get it to play? download http://sandboxfun.weebly.com/ XML <?xml version="1.0" encoding="utf-8"?> <SESSION> <TIMER TITLE="speed">1000</TIMER> <COUNT TITLE="starting position">10000</COUNT> </SESSION> FLA //DynamicTex...

EventDispatcher between an as and an fla?

Hi everyone. I am making a fighting game in Flash and while I have everything running, I am missing something: a victory/loss screen. Logically, I know how to do it: if character.hp < 0 { character.dead = true; dispatchevent("death", event) } My problem is that I have no idea as to how to code it. I know I will use two classes...

Loading SWFs into another SWF with a scrollbar class imported from a folder

I'm building a small Flash Projector file. I'm loading external SWFs into a main SWF. The external SWFs will contain a scrollbar (sometimes 2) imported from a folder. The scrollbar works fine in the external SWF, but when I try to all the SWF to the main SWF, I get the following error. I'm still a novice to AS3. [object maschera_8] Type...

AS3 Access of undefined property

Hi, first of all I am completely new to AS3. I want to create a simple website, with 3 buttons. Once you click on the button, content should appear next to it. But i have trouble programming even one button. Here is the script: stop(); photography_btn.addEventListener(MouseEvent.CLICK, photoclick); function photoclick(event:MouseEvent...

TweenLite onComplete fired instantly?

After I finish a tween, I would like to change my variables, then only my mouse movement would have start to run some functions, but it seems like the onComplete function fired immediately messing all the things out. Isnt't that onComplete function will only run after an action is done? Any other way to like after running the Tween.to li...

AS3 Embed Image Instead of drawing graphics

I've got a custom AS3 scrollbar that I need to modify. The scroll thumb (the draggable part of a scrollbar) is currently just done by drawing a rectangle. But I need it to look more like a real scrollbar. Not sure how to modify the below code to import/use a scroll thumb image: scrollThumb = new Sprite(); scrollThumb.graphics.lineSt...

AS3 - Can I know if a class implements an interface (or is a subclass of another class) ?

With this code function someFunction(classParam:Class):Boolean { // how to know if classParam implements some interface? } i.e. Comparing classParam with IEventDispatcher interface: someFunction(EventDispatcher) // returns true someFunction(Object) // returns false I know it can't be done with is operator. But, is there a way ...

event flow in action script 3

I tried to dispatch a custom event from some component on the stage and I registered another component to listen to it but the other component doesn't get the event. Here is my code; what did I miss? public class Main extends MovieClip //main document class { var compSource:Game; var compMenu:Menu; public f...

Having constrains object to move X,Y at the same time?

The stage is separated into 4 sections, and I will be moving the camera around the stage. So at each particular section the camera will have an area of constrain it can move. I mange to constrain its X & Y, but it could only navigate either X or Y. How to move in X+Y at the same time? if (mouseX>sec2maxX) { TweenLite.to(...

Set scaleX property on a Sprite without altering the child inside

Is this possible? My site is set up with next and prev buttons on the right and left sides respectively, and as you roll over either of the hit areas around the buttons a Sprite fades in which contains a TextField that describes the next page. Said Sprite calls the StartDrag() method, so it follows the mouse within the bounds, which is...

How to determine code and assets size within a SWF?

Is there a way to take a compiled SWF file and figure out how much of it's size is used by code and how much is assets (images, etc)? I'd like to see if I can get my Flex SWF smaller but I'm unsure what's taking up the most space. ...

How to pass a reference to a JS function as an argument to an ExternalInterface call?

Summary I want to be able to call a JavaScript function from a Flex app using ExternalInterface and pass a reference to a different JavaScript function as an argument. Base Example Given the following JavaScript: function foo(callback) { // ... do some stuff callback(); } function bar() { // do some stuff that should happe...

AS3 serialization of Vector of custom objects

What is serialization support like for the new Vector class? I have a Vector.<GameMove> which I'd like to serialize into a ByteArray. GameMove is a custom class. I presume it's necesssary to call registerClassAlias() on GameMove, but do I also have to register Vector.<GameMove>? It's it it's own distinctive type, or is it kinda composed...