actionscript

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...

Flash AS2 (CS4) - play sounds in sequence when each has ended.

Hi people, I have 3 sounds that i would like to play, they are in my library. I can play any of of them using soundName.start(0,1) with the code below: firstSound = new Sound(); firstSound.attachSound("Sound1"); secondSound = new Sound(); secondSound.attachSound("Sound2"); thirdSound = new Sound(); thirdSo...

Problem with components after migration project from Flash CS3 to CS4

I start flash as3 project on Flash CS3, about one year ago. After compile it on CS4, I get this error (on Russian): TypeError: Error #1009: Не удается вызвать свойство или метод со ссылкой на объект "null". at fl.controls::TextArea/drawLayout() at fl.controls::TextArea/draw() at fl.core::UIComponent/callLaterDispatcher() B...

Can the Flash CS4 [embed] tag be made to export assets to frame 2 rather than frame 1?

We're working on a Flash CS4 project where the main .fla file has ballooned in size and 'Publish' is taking forever. I suspect a large amount of the size (and at least some of the compile time) is due to the quantity of audio symbols in the library. I would love to remove this unnecessary bloat from the .fla file. I've experimented with...

How do I change a fill colour using ActionScript 2?

I have a very simple .fla file. There's a shape on the stage with a fill, and I want to change its colour when the movie starts. Googling seemed to suggest: myColor = new Color(myClip); myColor.setRGB(0xFFFF00); but it didn't seem to work. Any suggestions?.. ...

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...

flash action script - is there a library to simulate human dancing?

I want to write a flash to simulate people dancing, but I think if I make all the animation by hand, it will be a huge work. So I am thinking if there is a library(or other things people has done previously) that I can make use of. I can build the character, the foot, the arm and head etc. What I want is an algorithm to apply to the who...

Looking for a method in flash to read a string from a local app

I am looking for a way that can be used in my flash app to read a string from my local application, currently I am using activex to communication with the app and then pass that to flash. But I am wondering is there any alternatives that use pure flash techniques. ...

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. ...

AutoHiding Custom Scrollbar Flex 4

Hello, I have a custom scrollbar that controls a group as its viewport. <s:HGroup> <s:Group width="520" height="380" clipAndEnableScrolling="true" id="descriptionBox" > <s:RichText text="Test Test Test Test Test Test Test " width="490" textAlign="justify" fontFamily="Arial" fontSize="12" col...

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...

understanding Array::splice in as3

I am trying to remove an object from an array. but from some reason its not working. I am under the impression that a splice accepts 2 parameters. the position of the array. and for parameter 2 , how many to delete from then on out I just want to delete one array so I am doing this array.splice(i,0); but it isn't working. can someone...

null an object kill reference or the space in memory

This might be a dumb question. I think I already know the answer, just clarify. If you declare a object in varible1 and then pass the value into varible2. If you decide to null varible2 would that kill just the reference or the object itself as well. I want to say no, but then again, everything you do to the reference it self, also affec...

Flash AS2 (CS4) - setInterval causing for loop to not work.

I have some simple code: function testing(){ for (a=1; a<=4; a++) { this["btn"+a].enabled = true; } } If i run this function from anywhere it works fine. If i run this function from myTimer = setInteval(testing, 3000); it will not work. If i add other random code into the function it (the newly added c...

Flash As3 Window resize issue.

hi I have a flash script, i added one move clip via addChild, my movie area is 500x400 and the movieClip i aligned to center. But when am trying to set the size with in browser its not aligned to center. all my calculations are getting wrong. package { import flash.display.*; import flash.display.Stage; import flash.geom.*; ...

Import SWF to FLA

I can show a swf into flash simply with this code var request:URLRequest = new URLRequest("myswf.swf"); var loader:Loader = new Loader() loader.load(request); addChild(loader); But with import > import to stage there is no any swf when ctrl+enter. There is only 5-6 empty frame in timeline. How can I solve this problem?? Another quest...

Get ExternalInterface definitions in Javascript

Is there a way to get a list of the exposed functions from a Flash object? For example, you could get a list of all methods in an object by executing: for (var i in object) { if (typeof object[i] == "function") { console.log(i); } } The only issue is that this won't expose any methods registered through the ExternalInterfaces...

How to detect when mouse is over HTML layer over Flash movie?

I have a Flash movie that is embedded in an HTML page that has a DIV in a layer over the top of the movie. The Flash movie scrolls based on the mouse position over the movie. The client wants the scrolling to stop when the mouse is over the DIV. I've tried using the mouseLeave event, but that is not triggered by the DIV. Is there a wa...

How to save the text file without dialogue box in actiondcript 3?

Hi, i want to save the text file without dialogue box and store the given particular path in flash actionscript 3.0 or 2.0. if anyone know above issue,let me know ...

Hide a Button in AS3?

I have a button called myBtn In my actions in Frame 1 I have tried both: myBtn.visibility = false; myBtn.enabled = false; Both give me the error: 1120: Access of undefined property myBtn. ...