actionscript-3

AS3: Inserting XML Elements Alphabetically By A Property

So I'm having a slightly tricky issue... I'm generating an XML file within a class I'm writing. Let's say this was the starting XML: <base> <container id="0"> <element type="Image" x="0" y"0" /> <element type="Image" x="100" y"0" /> <container/> </base> I want to add additional <element>'s. The first order of...

play midi files in flash

is there a way to play midi files in flash? using actionscript 3? ...

AAC/MP4 not working in ActionScript 3's NetStream

I'm trying to play a remote AAC file in ActionScript 3 in Flash CS3 and am currently using this code: var url:String = "http://a1.phobos.apple.com/us/r1000/020/Music/d4/50/94/mzm.kjjofihr.aac.p.m4a"; var connect_nc:NetConnection = new NetConnection(); connect_nc.connect(null); var stream_ns:NetStream = new NetStream(connect_nc); stream...

Get dominant or average color in getPixels ByteArray

So, I've got this code: import flash.display.BitmapData; import flash.display.Bitmap; import flash.geom.Rectangle; import flash.utils.ByteArray; var bmd:BitmapData = new BitmapData(10, 10, true); var seed:int = int(Math.random() * int.MAX_VALUE); bmd.noise(seed); var bounds:Rectangle = new Rectangle(0, 0, bmd.width, bmd.height); var p...

Actionscript 3 freeing class variables

Suppose I have a class structure like the following, where I have a temporary child that is displayed and later replaced and as such no longer needed. However as multiple methods access that child before, I need it to be a class variable. So after replacing that child, I no longer need it and want to allow the garbage collection to reus...

Any plans to update this to AS3?

In my experience, the text rendering is better in flash 9/10 AS3. Are there any plans to get sIFR working with AS3? ...

Updating an ASP.NET iFrame without a page refresh using Actionscript 3

I would like to have a FLEX SWF Menu in .NET that is animated, and use button clicks to update an iFrame in an .NET 2.0 Ajax enabled application without a page update or refresh. If I use URLVaribles in Flex, The only way I've gotten to them to ASP.NET is via URL Page Navigation which always refreshes the screen. There is a LOADVARS fun...

pdf read pages to BitmapData in AS3

I’m starting a project in flash AS3 and my objective is to load any pdf file into my flash project and convert all its pages to BitmapData... I am familiar with byteArray and I know I must access the pdf in binary level but I don’t know where to start and how to start. I was hoping if you could give me some insight? Maybe a suggestion ...

getting a shared object to expire after browser session in FLASH ?

Hey all, I'm looking for a way to play flash animated content once ( even as the user navigates to different HTML pages with similar flash content) and expire after a set amount of time or after the browser is closed. I'm aware I could use a shared object for this but can't seem to find info about how to clear them at browser session e...

AS3 border layout manager?

What's the simplest, quickest way to achieve a fluid border layout in pure AS3 / Flash? I'm using Flex SDK + FlashDevelop to develop a video player and I want to put some controls on the left, some controls on the right, but leave the scrubber in the middle. I want the scrubber to resize horizontally depending on the size of the player. ...

why is ExternalInterface available inside Flash ide

hey I'm trying to build this simple debugger class so i can see flash vars inside the browser console and if I'm testing it inside the flash ide i will get the good old tracer. But for some reason ExternalInterface.available returns true inside the Flash ide!? package libs { import flash.external.ExternalInterface; public class...

save state of a dataGrid: visible columns, columns width and order

I want to save remotely (on a database) the state (visible columns, columns width and order) of a Flex3 DataGrid. For width and visibility I can simply save them by accessing each column attribute.. ugly but possible.. But for the order? Do I have to create the dataGrid dynamically?? Any idea is appreciated thanks ...

Flash compile error, access of undefined property (button)

as3 cant reference to button:"nerbtn" name when compiling. Trying to add eventlistener to the button. This is the code: nerbtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { nextFrame(); } This is the compile-error:1120: Access of undefined property nerbtn. ...

advantages and disadvantages to having multiple loops flash

What are the advantages and disadvantages of having just one main loop and having a main class control individual objects on your stage, in oppose to having each individual object have its own loop and giving it the responsibilities of doing what ever it has to do on its own. What are consider best practices. ...

Detect NetStream events with AS3 Video Object (not component)

I have created a FLV video player using the AS3 flash.media.Video object (not the FLV playback component) and I am trying to listen for meta events and Cue Points embedded in the FLV video but I am not receiving any when I trace the movie. The cue points are not being created dynamically, they are in the FLV video. Video embed code: ...

Flex 3: Determine if scroll panel child is visible

Let's say I have a canvas with a fixed height and a vertical scroll bar. And the canvas has 10 children in a vertical line (like a VBox) whose combined height exceeds the height of the canvas. Based on the scroll bar position, only some of the children will be visible at a time. Is it possible to determine which children are actually vi...

Flash video playback, how to determine seconds loaded?

I'm trying to accurately determine how many seconds of a video (NetStream) have been loaded so I can scrub/seek correctly. First I tried doing duration*(ns.bytesLoaded/ns.bytesTotal) but this is inaccurate by maybe 15%, ie if that calculation says 20 seconds is loaded and I scrub to 20 seconds ns.time will tell me it can't go past 17 se...

Pause and resume download in flex?

Is it possible in an air application to start a download, pause it and after that resume it? I want to download very big files (1-3Gb) and I need to be sure if the connection is interrupted, then the next time the user tries to download the file it's start from the last position. Any ideas and source code samples would be appreciated...

pixel collision detection for flash

I was told the pixel detection is costly for regular windows games. Is this the same for flash ?? Or would pixel detection be lighter compared to other detections flash has to offer. Flash has the getPixel32 method which makes it easy for detecting pixels. If I am bliting my game, would it be wise to use getPixel32 for collision detectio...

AS3 Removechild freeze

Hello, I have a problem with switching views in an app. I have the following set-up Stage->MasterViewSprite->SubviewSprite->GallerySprite Images are added via addchild to the GallerySprite. When the users clicks an image, the MasterViewSprite removes the SubviewSprite and adds a different SubviewSprite. I find that the more image ...