actionscript-3

Is this dependency injection in ActionScript 3?

Hi. I have a Main.fla (controlled by Main.as) that has a child named Slide (a Movieclip controlled by another class, Slide.as). Sometimes, my Slide object have to call the method "nextSlide" on his father, Main object. To do this I tried "this.parent.nextSlide()", but I got this error: 1061: Call to a possibly undefined method nextSli...

how to avoid flickering when changing the source of an mx:Image in flex

Hi, in my mxml file I have images declared like this: <mx:Image x="0" y="0" source="assets/bigpicture.png" id="picture1"/> and at some event I do: picture1.source = "assets/bigpicture2.png"; However this results in flex removing the picture, and when it has loaded it will show it again. How can I make the mx:image make so that it...

Flex Component Lifecycle: validateNow, validateDisplayList, invalidateDisplalList, commitProperties, etc.

I am extending VBox to make a Calendar component. What method should I override to add the code to draw itself? What is the difference between all these methods? Is there something I should be putting in each one, or is there a specific method I can just override, add my drawing code, and have it work? Thanks! ...

Flex: changing Flex component styles in AS3

Hi, in MXML, there is a Button class which you can instantiate like so: <mx:Button id="something /> but what if you wanted to dynamically build this in AS3 and add it to the Flex app dynamically, without the use of components (just AS3) and then modify Flex's styles, for example, here you access the Button's properties and set them: ...

Casting problem once again

I am trying to dynamically tween some movieclips in my SWF but have problems with their dynamically created names. Here is the code function slidePhoto(e:TimerEvent):void { i = "i3"; movieClip = i as Object; Tweener.addTween(movieClip,{x:0, y:0, transition:"easeInOutQuint", time:1, onComplete:waitMe, onCompleteParams:[4000, ...

actionscript 3: returning array in a class

Hi, I built a class that parses JSON data, stores it in an array, and now I want to return that data so that it can be stores in an array in my root AS file. I'm eventually trying to pass the returned array to another class. My class looks like this: package com.src { import flash.display.Sprite; import flash.net.URLRequest; import ...

AS3 Memory Conservation (Loaders/BitmapDatas/Bitmaps/Sprites)

I'm working on reducing the memory requirements of my AS3 app. I understand that once there are no remaining references to an object, it is flagged as being a candidate for garbage collection. Is it even worth it to try to remove references to Loaders that are no longer actively in use? My first thought is that it is not worth it. He...

Multiple text areas with different rotation values causes borders to be very very wrong

If you have two textareas, one has a rotation value besides 0 and the other has no rotation value or a value of 0 and you 'tab' focus from the one w/rotation to the one w/out. The border around the textArea w/out rotation will be rotated. If you set the rotation value of the non-rotated text field to a non-zero number, even 0.01, it fi...

External linking of flex 3 app, where did it come from?

I'm feeling the topic isn't the best one, but here goes. I've made a flex 3 app that is sitting on my web server. People will be able to link to this flex app on my web server on their own sites/blogs/forums and so on. Is there any way I can log where a user that clicks on it comes from? Example: the URL to the flex app is http://www...

Text Input restrict in Flex3 Air

Hi, I need to restrict the user and allow only first character as + or - or 0-9 and other character as 0-9..how can i do this in regular expression validator the below expression works but i need in restrict field. <mx:TextInput id="txtTop" restrict="[0-9+-][0-9]*$" /> Valid values are +023 -123 23 0 invalid +-123 fsaf -+2...

3D, AS3, Flex - Convert degrees of rotation to visible height

I need to know what the visible height of a display object will be after I change it's rotationX value. I have an application that allows users to lay out a floor in 3D space. I want the size of the floor to automatically stretch after a 3D rotation so that it always covers a certain area. Anyone know a formula for working this out? E...

visible property of DisplayObject

For example I have a hierarchy of movie clips. mc1 is a child of mc, and mc2 is a child of mc1. Turns out that when I set mc1.visible = false; mc2.visible stays true. Is that supposed to happen? Is there a shortcut for testing visibility of mc2? Code to play with: var mc = new Sprite(); mc.graphics.beginFill(0xFF0000); mc.gr...

AS3 Dispatch Event from Class

Hi, I have a class which makes a url request and stores data from that request. When the data is retrieved, parsed, and stored into an array, I'm sending a dispatch event which I listen for in my document class. In the event handler function in the document class, I'm accessing the array that was compiled from the class. The array insid...

Why can't Flash CS3 find the MovieClip base class even after classpath is set (AS3)?

Tearing my hair out. I created an as3 class - blah.Foo, which extends MovieClip. it is not in a package, cos Flash CS3 complained about nested packages, so it's a 'bare' class. And yes it's nested in myproj/as/blah/Foo.as And yes, it imports flash.display.MovieClip at the top of the file. I also have myproj/fla/main.fla. main.fla is se...

AS3 & Swfmill: How to access assets in swfmill-generated library swf

Hi! I'm creating library swfs in as3 this way, works like a charm (except for the slow mxmlc compiler): package { import flash.display.Sprite; public class Library extends Sprite { [Embed(source="assets/test.png")] public var TestBitmap:Class; } } I would like to create the same kind of libary using swfmill. I've tried ...

AS3 Basic Parsing JSON question

Hey, I'm having a problem parsing a JSON file in AS3. Im trying to parse multiple JSON arrays, but don't really know how to get to the next after accessing the first one. My JSON file looks like: { "term": [ { "id": 4211, "place": "NEW YORK CITY" }, { ...

AS3 Scrollbar content formula

I've created a horizontal scroller and now I'm stuck on how to calculate the position of the content when the scroller is at a position. private function checkDrag(event:Event):void { var procent:Number = (stage.stageWidth/(buttonLR.x+buttonLR.width))*(LISTmc.width) if (drag) { TweenLite.to(LISTmc,1,{x:-procent}); } //buttonLR...

Programming game in flash/as3

Hi, I have a bunch of ideas for different games (for programmers) where you have to write some program to complete the puzzle; The language shouldn't be too complicated and I even started thinking about a graphical language like Scratch (http://scratch.mit.edu/). Anyway, I wanted to explore what people had done already porting various ...

AS3 Play contents of a symbol

I've grouped a multiple layer 1 frame actionscript driven animation into a symbol. (simply put, imagine a 1 frame image being tweened by code over a few sec, in this symbol) Now I'd like to play the contents of this symbol using an event listener. But stuff_mc.gotoAndPlay(1); and Test Movie doesn't play a thing (doesn't even show the ...

Asynchronous Lazy Loading in ActionScript

I am having trouble with implementing this. Basically, I have many large chunks of data that need to load with URLoader. And I want to use lazy loading because eager loading takes up a lot of network resources/time. For example: class Foo { private var _resources:Array; public get_resource(id:String){ if ( _resources...