actionscript-3

Linking a button to a movie clip... gotoAndPlay() doesn't work!

I have a button, "pb". I have a movieclip, "pm". I want the clip to play certain frames when I press the button. I have a layer on top of every other layer, with only one frame. In the ActionScript for that frame, I have put: stop(); pb.addEventListener(MouseEvent.CLICK, onMouseClick); function onMouseClick(event:MouseEvent):void ...

Why loaderInfo.bytesTotal is Zero

Why loaderInfo.bytesTotal is Zero when run on server but run Test Movie it isn't zero? My action(Preload) stop(); addEventListener(Event.ENTER_FRAME,loaderF); function loaderF(e:Event):void{ var toLoad:Number = loaderInfo.bytesTotal; var loaded:Number = loaderInfo.bytesLoaded; var total:Number = loaded/toLoad; if(lo...

Packaging External File Dependencies in Flash

I just started learning ActionScript, so maybe this is obvious. I'm loading in .txt files to generate content for my Flash application. However, I can't seem to find a way to package the .txt files with the .swf when I publish my application. I'd like to be able to run the .swf from anywhere without it depending on the files. Is ther...

Unexpected Flash Security Exception When Using URLLoader

Hello, What I am trying to accomplish is to upload some binary data, specifically a ByteArray representing a PNG image, to a server using the URLLoader class in conjunction with URLRequest. When I set the contentType property of the URLRequest to 'multipart/form-data' instead of the default, the call to urlLoader.load() results in a se...

-Call static method from loaded swf or -How to expose an API for client movies

Hi all, I have main movie A that loads (with a Loader) another movie B inside. In movie A I have a class API, with a bunch of static methods that perform actions in A. A.as public class Main extends MovieClip{ public Main() { b= new Loader(); b.load("b.swf"); addChild(b); } } ------- API.as public class API{ public stati...

shape map file decoding

I recently started off on working with shape map files, I downloaded a few shape files from the internet, the files had the following extension .shp, .dbf, .shx which I am unable to decipher what these extensions are. Then I found some actionscript libraries to parse these files here However I am not able to understand the documentati...

Centering item renderers in a HorizontalList

I am trying to center itemRenderers in a horizontal list if the number of items in the list is less than the maximum visible number. Has anyone found a good way to do this? See an illustration of what I mean if it is hard to picture. Thanks! ...

Uploaded flash movie expanding to entire page... want to just show correctly proportioned stage.

I'm sure this is very simple, but it's not readily apparent how to do it. I created a flash file. Uploaded the file to my server. I'm going to it at blahblah.com/demo.swf , not included in any html or anything. When I go to the file, the browser loads it in "fullscreen" mode, taking up the entire window size. The size changes as the wi...

Get info after fileReference upload?

Normally when I send information to PHP scripts via URLLoader, I have the PHP return various success codes so I can have my Flash files respond according to whatever success code the PHP returns (0 is a failure, 1 a success, 2 is some other error code, etc.). Now I'm trying to submit a form with a bunch of data in it (name, email, birth...

How do I access another Movieclip from a Movieclip using AS3?

I'm creating a game in Flash CS4 and using Actionscrip 3.0 I'm adding all my graphics via my AS3 code. I added my hero (A movie clip instance) in the main game class. In my enemy class (the movieclip) I want to make a generic AI which will check to see how close the hero is to the enemy. I tried various ways but I'm not sure how to p...

Flex collision testing with hitTestObject

I'm trying to test clipping on two canvases. Both canvases are 100px wide. They're 20px apart. I've placed a label inside one and made it 200px wide. Scroll bars will show up on the canvas. When I don't have the label inside and use hitTestObject it returns false. When I place the label inside it returns true. Is there any way to alter t...

How to get the current package as a string at runtime in actionscript

Hi, Im trying to find some way (in actionscript 3) to output info for the current package at runtime. Given the following code snippet; package com.foo.thing { import com.foo.Helper; public class Tester { public function Tester(){ Helper.tracePackage(); } } } I'd want the tracePackage method to trace out th...

Why should I use MXML in flex 3?

I've been writing in actionscript 3 using flex builder 3 for a couple of weeks now and never encountered the need to use anything like MXML. I code all layout and design in pure actionscript. I am not sure why, but many people immediately expect me to have written a lot of MXML when I say that I'm using flex builder. Is MXML really rec...

Apply a filter to a specific area of a DisplayObject?

Is there any way of applying a ColorMatrixFilter to one rectangular area of a DisplayObject, leaving the rest untouched? The DO is a container, and the user interacts with objects in it, so taking snapshots to change its appearance isn't an option. ...

What are the benefits of Spring Actionscript considering Dynamic Proxies and Reflection is limited

What are the benefits of Spring Actionscript considering Dynamic Proxies are not possible in the current version of Actionscript and Reflection is quite limited. So for example I could specify my object creation in an XML application context, but why would I do that when I can simply specify that in code, and hence take advantage of sta...

Dynamically Handling Events with Function Expression

I have a class which exposes literally dozens of events(before you get of on a tangent about whether that's good/bad design, just know that I didn't make that class). The event object of each event(eventParam in the below code) always has a toDebugString function, that basically creates a string containing all of the event object's prop...

How do I set the state of a SimpleButton with Actionscript 3

I have a .fla file created by our designer and he has created a set of SimpleButtons that I have wired to a video player. Now I need to set the status of a button to "over" if the video that it is associated with is playing. The button is somewhat sophisticated graphically so its not something that I want to recreate with AS. Is there ...

Efficiently splicing items from an array using Flex

I have overcome a problem, but my solution seems really inefficient and clunky. Please consider this problem: I have an array collection with articles in. This array collection is filtered to a currently selected article category.  There is a cursor bound to a view that shows the current article. When a category is deleted I need to ...

AS3 driving me nuts......

Ok here is what I am currently trying to do. I have a class called vdata.as which takes 2 paramaters both are strings sent from the main stage. Parameter one is the location for an XML file that I need to open and read. The second parameter is the name of the video I am currently looking for. Now I can get the data from the XML file and...

Floating Point Numeric Representation in Actionscript?

Is it possible to get the raw bytes of a floating point (IEEE-754) Number object in Actionscript? Or alternately, if I can get the sign (1 bit), mantissa (52 bits) and exponent (11 bits), then I can do the bitshifting myself and construct the raw byte array. I'd like to create precise, compact string representations of Number values (h...