actionscript-3

Characters count only start counting on the 2nd character??

I have a function that calculates how many characters remaining the user can type, but I don't know why it only starts counting from the 2nd characters. Means at the end I will able to type an extra character from the maximum amount I set. wInput.maxChars=30 wInput.addEventListener(KeyboardEvent.KEY_DOWN, calculate); private function c...

Flex - Use Variables for Object Attribute Names

How do you use variables to access Object attributes? Suppose I have an Object declared as follows, var obj:Object = new Object; obj.Name = "MyName"; obj.Age = "10"; How would i do something like this, var fieldName:String = "Name"; var fieldAge:String = "Age"; var Name_Age:String = obj.fieldName + " ," + obj.fieldAge; The code ...

Actionscript 3 Sprite AddChild

Im new to actionscript 3 and am a little confused about how the addchild function works. I want to draw 5 houses. each house has a roof and wall. Each wall has a door and a window. I have the following classes and this is how I grouped them class Main class House class Roof //a triangle class Wall //a rectangle class...

AS3 - Event listener that only fires once

I'm looking for a way to add an EventListener which will automatically removes itself after the first time it fires, but I can't figure a way of doing this the way I want to. I found this function (here) : public class EventUtil { public static function addOnceEventListener(dispatcher:IEventDispatcher,eventType:String,listener:Func...

prototype functions off custom functions

Its a complicated senario for me. I have a sound management singleton with an asset like dictionary storing all referances to my urls and assets and the guff inside it- I have a function called addItem(id:String, url:String):Object I would love to do something similar as soundManager.addItem(id:String, url:String).play() or soundManag...

How to call wcf function from as3

I have been cosuming webservices using alducente.services.WSDL classes with old ASP.NET services from Flash. Trying the same as3 calls with the new WCF services I get the error that the method I am calling does not exist. According to http://stackoverflow.com/questions/1614157/flash-connecting-to-a-wcf-service I have declared the func...

as3 dynamic button name capturing problem

i am using this code below to dynamically capture the name of the button pressed and then playing the related balloon movie clip animation. stage.addEventListener(MouseEvent.CLICK, player); function player(evt:MouseEvent){ var nameofballoon = evt.target.name; nameofballoon =nameofballoon.substring(nameofballoon.length-1,nameofballoon...

Can I make Flash CS4's 3D functionality work with 3D glasses?

I know it can be done in papevision -> http://codejockeyscorner.blogspot.com/2009/04/papervision3d-anaglyph-scene.html but I'd like to be able to do it just using Flash's 3D functionality. I'm aware that its more 2.5D but was wondering if anybody knew how to create a situation so you can view it with 3D glasses (red and blue) ...

How to set HTML list as mx:DataGrid data provider?

So I have Html like this http://trac.edgewall.org/wiki/RecentChanges (I want to create some Flash Track reader which will be opensource) I need to list in my DataGrid Index of all viki pages in form like +-----------+--------+ |page name |page url| +-----------+--------+ | name | url | +-----------...

regex to parse a iCalendar file in ActionScript

Hello, I use a library to parse an iCalendar file, but I don't understand the regex to split property. iCalendar property has 3 different style: BEGIN:VEVENT DTSTART;VALUE=DATE:20080402 RRULE:FREQ=YEARLY;WKST=MO The library uses this regex that I would like to understand: var matches:Array = data.match(/(.+?)(;(.*?)=(.*?)((,(.*?)=(.*...

How do modify image data in SlidesShowPro using Flash ActionScript3

I'm using SlideShowPro with Flash AS3 and I have the following code: function onSlideShowClick(event:SSPImageEvent) { if (event.type == "imageClick") { // modify the link for when the image is clicked. } } How can I modify the link for when the image is clicked? Can that be done here? Elsewhere? ...

the correct actionscript to find if object already exists

I have a Rect object that I'd like to create and set its properties only once. After that, I want to just modify its properties since it already exists. This is my general idea if(theRect == undefined){ Alert.show("creating"); var theRect:Rect = new Rect(); //then set properties addElement(theRect); //then add it using addElem...

Array items sorting and editing with MXML AS3 (in practical case)?

I have an array with lots of items with same names like CloudObserverCMSStub edited CloudObserverCMSStub edited CloudObserverCMSStub created CloudObserverCMSStub2 edited CloudObserverCMSStub2 edited CloudObserverCMSStub2 created and different related to names dates for each item in such format Wed, 17 Mar 2010 22:32:09 GMT...

DisplayObject.rotation not matching trig functions

I'm trying to label an animated pie chart, and I've been having a great deal of trouble getting rotated objects to line up with trigonometrically-positioned objects. So, for example, if I have a pie piece that's middle is angle theta and has been rotated n degrees in a tween, and then I try to position a label with code like this: label...

Returning errors from AMFPHP on purpose.

When using flash remoting with amfphp, what can I write in php that will trigger the 'status' method that I set up in my Responder in Flash? Or more generally, how can I determine if the service call has failed? The ideal solution for me would be to throw some exception in php serverside, and catch that exception in flash clientside......

Actionscript Removing Display Objects

i don't understand why none of my display objects are not being removed. when i press the button, i'm expecting a trace and removal of both shapes and the button, but nothing happens: import fl.controls.Button; var shape1:Shape = new Shape(); shape1.name = "Shape1"; shape1.graphics.lineStyle(4, 0x000000); shape1.graphics.beginFill(0x0...

How to remove part of the string starting from special char (or word) in ActionScript?

so I have a string "bla dla dla vre bla 54312" I want to turn it into "bla dla dla " by saying something like function(string, "vre"); how to do such thing? ...

How to get data from http protected URL

so I have a Track system with some kind of protection. So to get some data from any URL you have to pass protection like this http://188.134.14.27/projects/cloudobserver/login and then (in browser) you can see some pages http://188.134.14.27/projects/cloudobserver/wiki/CloudObserverCMSSetup (if you havent passed login youll get no conte...

How to delete part of a string in actionscript?

So my string is something like "BlaBlaBlaDDDaaa2aaa345" I want to get rid of its sub string which is "BlaBlaBlaDDD" so the result of operation will be a string "aaa2aaa345" How to perform such thing with actionscript? ...

How to put spaces before Capital letters in actionscript?

So I have a string "SmartUserWantsToLive" I want to generate from it or any such string with capital letters strings like "Smart User Wants To Live". How do I do this? ...