actionscript

I need to ping to an network with flash or actionscript

十年热恋 提交于 2019-11-29 07:54:26
I have created a network trouble shooting tool in flash. The design will have all the componenets on the screen. I have to ping to every component once in minute. I have finished the design part. Please someone help me how do i ping a webaddress or IP in flash. I need a sample code.. Im using Flash CS3 What do you mean by you have all the components on the screen and you have to ping every component once in a minute? If by ping you mean an app, what checks the time-response of a url, then you can try to play with this code: var ldr:URLLoader = new URLLoader(); ldr.addEventListener

Fast or asynchronous AS3 JPEG encoding

时光怂恿深爱的人放手 提交于 2019-11-29 07:33:21
I'm currently using the JPGEncoder from the AS3 core lib to encode a bitmap to JPEG var enc:JPGEncoder = new JPGEncoder(90); var jpg:ByteArray = enc.encode(bitmap); Because the bitmap is rather large (3000 x 2000) the encoding takes a long while (about 20 seconds), causing the application to seemingly freeze while encoding. To solve this, I need either: An asynchronous encoder so I can keep updating the screen (with a progress bar or something) while encoding An alternative encoder which is simply faster Is either possible, and how can I do it? Jason Setting up the encoder to be asynchronous

Sending HTTP request with multiple parameters having same name

北慕城南 提交于 2019-11-29 07:05:49
I need to send a HTTP request (and get XML response) from Flash that looks similar to following: http://example.com/somepath?data=1&data=2&data=3 I.e. having several parameters that share same name, but have different values. Until now I used following code to make HTTP requests: var resp:XML = new XML(); resp.onLoad = function(success:Boolean) {/*...*/}; resp.ignoreWhite = true; var req:LoadVars = new LoadVars(); req["someParam1"] = 3; req["someParam2"] = 12; req.sendAndLoad("http://example.com/somepath", resp, "GET"); In this case this will not do: there will be only one parameter having

How do I access a movieClip on the stage using as3 class?

十年热恋 提交于 2019-11-29 05:08:39
public class MyClass extends MovieClip { public function MyClass():void { my_mc.addEventListener(MouseEvent.CLICK, action); } private function action(e:MouseEvent):void { trace("cliked"); } } Timeline code var myClass:MyClass = new MyClass(); addChild(myClass); I can't able to access the my_mc (placed in FLA) movieclip. How do I access? Try this: public class MyClass extends MovieClip { public function MyClass() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); }// end function private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init);

What is the difference between object main timeline, object Stage and root in as3?

眉间皱痕 提交于 2019-11-29 04:12:56
I want to know the difference between [object main timeline] , [object Stage] and root in as3? I have read from the topic How stage, root, and MainTimeline Fit Together . But I didn't get clearly. Luke Van In I think the article you linked to sums it up quite nicely (even if it doesn't explain it all that well): To summarize: one stage, one root per SWF (which is the main timeline) and that root is an instance of a document class or the MainTimeline class if a document class isn't provided Stage is probably the easiest to understand. There is one stage per Flash Player - think of it as the

What tools do I need to develop in ActionScript (in Linux)

a 夏天 提交于 2019-11-29 02:12:03
问题 I've never developed Flash before but I have a project where I want to use an ActionScript 3 library and I'm not sure what tools I need to start. To further complicate things my main development box is an Ubuntu box. Are there any necessary packages I need to install? Or any .deb 's I can buy? 回答1: A Windows or Mac box. :-) just kidding, actually you can use the Flex 3 SDK mentioned above and compile using the CLI. If these AS3 Libraries are indeed Flex libraries (sometimes there are

can an actionscript function find out its own name?

梦想的初衷 提交于 2019-11-29 01:45:45
given the following function A(b:Function) { } If function A(), can we determine the name of the function being passed in as parameter 'b' ? Does the answer differ for AS2 and AS3 ? I use the following: private function getFunctionName(e:Error):String { var stackTrace:String = e.getStackTrace(); // entire stack trace var startIndex:int = stackTrace.indexOf("at ");// start of first line var endIndex:int = stackTrace.indexOf("()"); // end of function name return stackTrace.substring(startIndex + 3, endIndex); } Usage: private function on_applicationComplete(event:FlexEvent):void { trace

How do you load a bitmap file into a BitmapData object?

假如想象 提交于 2019-11-29 01:25:34
In Flash, the BitmapData object can be used to store bitmaps in RAM, you can later draw them to a MovieClip using the beginBitmapFill() method. How do you load an external bitmap file (.jpg) into a BitmapData object? Even AS3 code would be helpful. Cotton AS3 code to load a PNG and "get" its bitmapData var bitmapData:BitmapData; var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); loader.load(new URLRequest("../lib/img.png")); function onComplete (event:Event):void { bitmapData = Bitmap(LoaderInfo(event.target).content).bitmapData; } Refering

How to implement the Adobe HTTP Streaming spec without using their Streaming server

对着背影说爱祢 提交于 2019-11-28 23:31:26
问题 As of Flash 10.1, they have added the ability to add bytes into the NetStream object via the appendBytes method (described here http://www.bytearray.org/?p=1689). The main reason for this addition is that Adobe is finally supporting HTTP streaming of video. This is great, but it seems that you need to use the Adobe Media Streaming Server (http://www.adobe.com/products/httpdynamicstreaming/) to create the correct video chunks from your existing video to allow for smooth streaming. I have tried

For VS Foreach on Array performance (in AS3/Flex)

半城伤御伤魂 提交于 2019-11-28 23:20:47
Which one is faster? Why? var messages:Array = [.....] // 1 - for var len:int = messages.length; for (var i:int = 0; i < len; i++) { var o:Object = messages[i]; // ... } // 2 - foreach for each (var o:Object in messages) { // ... } From where I'm sitting, regular for loops are moderately faster than for each loops in the minimal case. Also, as with AS2 days, decrementing your way through a for loop generally provides a very minor improvement. But really, any slight difference here will be dwarfed by the requirements of what you actually do inside the loop. You can find operations that will