actionscript-3

AS3 variables handling by AVM/compiler/scope

I have couple of questions about AS3 variables handling by AVM/compiler/scope .1. This code in Flash will throw an error: function myFunction() { var mc:MovieClip=new MovieClip(); var mc:MovieClip=new MovieClip(); } but it won`t throw an error in Flex (only warning in Editor). Why? .2. How Flash sees variables in loops? App...

Getting Stage from within a loaded SWF

Hi, For the scenario lets consider Car to be the highest SWF(stage) inside I load tyres. Inside tires I have rims. Now if the rims need to be positioned relative to the stage (car body) how can I do that? Inside rims if I write stage and load it results in an error. Any Ideas? ...

How to explain to client that you can't give them some of the source

We have a number of AS/Flex components that we've built over time and improved upon. They've been turned into components so they can be reused in different projects and save us time. So you can think of them as part of an in-house framework of sorts. We're now realizing that it doesn't make sense to release the source code for these com...

Stick element to bottom-right corner (AS3 - Adobe AIR)?

Hello I'm creating a simple AIR app with resize-functionality. Of course i need to position a resize-arrow to the bottom-right corner. Here's my code: stage.addEventListener(Event.RESIZE, handleResize); function handleResize(e:Event):void{ resize_btn.y = stage.stageHeight-resize_btn.height; } This doesn't work, my button gets out...

custom as3 class 04 by Dinesh?

package gpslab.com.facers{ import flash.display.*; import flash.events.*; import flash.net.*; import gpslab.com.facers.resource.ApplicationConst; import gpslab.com.facers.resource.ApplicationDTO; import gpslab.com.facers.resource.EventConst; import gpslab.com.facers.xmlLoader.XMLDispatcher; import br.com...

Stretching BitmapData in AS3

Hi! I'm trying to replicate this function from the Allegro graphics library: void stretch_blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int source_width, int source_height, int dest_x, dest_y, dest_width, dest_height); http://www.allegro.cc/manual/api/blitting-and-sprites/stretc...

Is there a more efficient AS3 way to compare 2 arrays for adds, removes & updates?

Hi all - I'm wondering if there is a better way to approach this than my current solution... I have a list of items, I then retrieve another list of items. I need to compare the two lists and come up with a list of items that are existing (for update), a list that are not existing in the new list (for removal) and a list of items that a...

AS3 Classes - Should I use them?

I'm working on a project in Flash CS4/AS3 and I have a document class set up but I am wondering about using that, as opposed to frame-based scripting. Most of what I have seen so far deals with how to create them, but doesn't offer much about why or when to use them. I know I can also pull in other classes beyond the document class but,...

Pixelation effect

Does anyone know how to archieve pixelation effect in AS3 which looks really smooth like this website: http://www.truly-design.com/site ?? ...

Reading component parameters and setting defaults

I'm pulling my hair on this because it should be simple. I'm trying to create a component and set its default properties. <CustomComp text="Some text" color2="0x939202" value="4.5" /> But when I initialize it, the parameters still don't register. I do like this: [Bindable] private var myColor2:uint = 0x000000; [Bindable] private ...

Are there any good tutorials for learning AS3 with FlashDevelop?

I found this question, and it mentions the FlashDevelop wiki. However, I couldn't find anything there at all. Where is a good place to start? I have done some work with MXML projects using the Flex SDK, but never any ActionScript programming. ...

ActionScript applying rotation of sprite to startDrag()'s rectangle bounds

from my main class i call to create a sprite and add it to the stage private function addSwatch(evt:MouseEvent):void { if (stage.getObjectsUnderPoint(mousePoint()).length == 0) { var swatchSide:Number = 100; var newSwatch:Sprite = new Swatch(0 - swatchSide/2, 0 - swatchSide/2, swatchSide, swatchSide); newSwatch.x = mouseX; n...

Is there a good library/way to split a big task in as3/flex?

As flashplayer has only one thread and is event driven, big tasks have to be divided to smaller tasks so that the application stays responsive. For now I've done this with the Timer by doing a small part of work in every TIMER event. Is there a better way of doing this (some library maybe)? What is your recommendation? ...

Getting TypeError: Error #1009: Cannot access a property or method of a null object reference.

hello friends, I have created small application for login in flex desktop application. In which I am refering webservice method for login for this have created the Authentication class. Now I want to refer different Textinput value for mobile no and Textinput value for password. In my Authentication class. for this I have created the ...

creating a Chat room in Flex.

Hi, I want to implement a Chat room in Flex 3. Please help me. Thanks!! ...

Accessing main class stage event listener.

I wanted to remove an event listener from main class stage, but i get the error 1120: Access of undefined property stage. How do I actually access the stage? custom class: import main; main.disableVcam(); main class: public static function disableVcam():void { trace("disable"); stage.removeEventListener(Mouse...

Decode amf3 object using PHP

My flash code: var request=new URLRequest('http://localhost/test.php'); request.method = URLRequestMethod.POST; var data = new URLVariables(); var bytes:ByteArray = new ByteArray(); bytes.objectEncoding = ObjectEncoding.AMF3; //write an object into the bytearray bytes.writeObject( { myString:"Hello World"} ); data.data = bytes; ...

flex 3 cancel tooltip event

I am trying to cancel a tooltip event (I only want it to display when the mouse is hovered over a certain area), and can't seem to figure it out. I tried stopPropagation, preventDefault, and stopImmediatePropagation, but none of them seem to work. Here the code I am using: private function toolTipCreateHandler(event:ToolTipEven...

Communicating to Parent SWF

Hey guys I'm having such a hard time of it today. I have a game, I've loaded into a parent SWF - I would like my parent SWF to accept events I dispatch from within the game, or have the ability to talk both ways. -- Reason is, I would like to unload and load the game back in, once the end screen is active. Any help and I'll give you...

could i get access to the loaded uri in actionscript for "loadmovie"

i wanna load a movieclip inside another movieclip with loadmovie or anything like this. so my question is.... could have i access to the location of the loaded swf-file inside the loaded swf-file? example: swf#1 loads swf#2 inside itself, so now the swf#2 should check its own uri with an identical key.. but without access to the loaded...