actionscript-3

Trying to use BindingUtils in Flash AS3.0

若如初见. 提交于 2019-12-22 19:43:11
问题 I am not able to make this code work in AS3.0 ( Flash ) with Flex SDK 4.0 included. import mx.binding.utils.*; [Bindable] var myValue:int = 0; var cw:ChangeWatcher = BindingUtils.bindSetter(myValueChanged, this, "myValue"); addEventListener( Event.ENTER_FRAME , ef); function ef(e:Event):void { trace("hello",getTimer()); myValue = getTimer(); } function myValueChanged(o:Object):void { trace("myValue: " + myValue.toString()); } The output i get is : myValue: 0 hello 157 hello 168 hello 171

Changing the slider into buttonMode

萝らか妹 提交于 2019-12-22 18:28:47
问题 I am trying to change the slider into buttonMode by using my_slider.buttonMode = true; but it doesn't shows handsymbol .Is there any other way to change the slider into buttonMode?. Thanks in advance. 回答1: i had the similar issue in one of my project. try this it will definitely work. // cmp_slider is component instance var mc = cmp_slider.getChildAt(1); // it is a drag button. mc.buttonMode = true; mc.useHandCursor = true; 回答2: my_slider.mouseChildren = false; my_slider.buttonMode = true;

Save a download without filereference

半世苍凉 提交于 2019-12-22 18:07:42
问题 Is there anyway to download a file with the URLLoader and then save it to the disk without using filereference or anything that uses a dialog? This is what I have but isn't working: public function onDownloadComplete(e:Event):void { DownloaderProgress.label = 'Download Done'; var loader:URLLoader = URLLoader(e.target); var rtsFile:File = File.applicationStorageDirectory.resolvePath("RTS.zip"); var rtsStream:FileStream = new FileStream(); rtsStream.open(rtsFile, FileMode.WRITE); rtsStream

Find the total bytes used by a bitmap in Flex

淺唱寂寞╮ 提交于 2019-12-22 14:52:22
问题 If I load a bitmap using a loader in Flex, I can use the loaderInfo.bytesTotal to get the size, total bytes used, of a bitmap. If I create a bitmap in run time, how can I find out the size, the total bytes used, by that bitmap. Please advice. Thanks 回答1: var bitmapByteSize:int = bitmap.bitmapData.getPixels(bitmap.bitmapData.rect).length; That might do the trick. 回答2: I think a better solution than the one above would be: var bitmapByteSize:uint = bitmap.bitmapData.width * bitmap.bitmapData

Find the total bytes used by a bitmap in Flex

拜拜、爱过 提交于 2019-12-22 14:51:33
问题 If I load a bitmap using a loader in Flex, I can use the loaderInfo.bytesTotal to get the size, total bytes used, of a bitmap. If I create a bitmap in run time, how can I find out the size, the total bytes used, by that bitmap. Please advice. Thanks 回答1: var bitmapByteSize:int = bitmap.bitmapData.getPixels(bitmap.bitmapData.rect).length; That might do the trick. 回答2: I think a better solution than the one above would be: var bitmapByteSize:uint = bitmap.bitmapData.width * bitmap.bitmapData

Adobe flash : Playing Speex Audio from a file

泪湿孤枕 提交于 2019-12-22 14:08:31
问题 I have tried really hard to find an example showing how to play speex encoded audio in flash. I tried the following code - var connect_nc:NetConnection = new NetConnection(); connect_nc.connect(null); var stream_ns:NetStream = new NetStream(connect_nc); stream_ns.play("RE-Sample.m4a"); avaible at - http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player _03.html I tested the above code with .flv videos and AAC encoded audio files and it works just fine. But when I try stream_ns

Adobe flash : Playing Speex Audio from a file

故事扮演 提交于 2019-12-22 14:07:02
问题 I have tried really hard to find an example showing how to play speex encoded audio in flash. I tried the following code - var connect_nc:NetConnection = new NetConnection(); connect_nc.connect(null); var stream_ns:NetStream = new NetStream(connect_nc); stream_ns.play("RE-Sample.m4a"); avaible at - http://www.adobe.com/devnet/flashplayer/articles/hd_video_flash_player _03.html I tested the above code with .flv videos and AAC encoded audio files and it works just fine. But when I try stream_ns

Difference between validateProperties() and invalidateProperties()

余生长醉 提交于 2019-12-22 13:57:21
问题 Can any one tell me about what is the Difference between validateProperties() and invalidateProperties() ? 回答1: invalidateProperties: Marks a component so that its commitProperties() method gets called during a later screen update. Invalidation is a useful mechanism for eliminating duplicate work by delaying processing of changes to a component until a later screen update. For example, if you want to change the text color and size, it would be wasteful to update the color immediately after

Is there a way to read local files in ActionScript 3 “silently”'?

ぃ、小莉子 提交于 2019-12-22 12:41:47
问题 I'm developing an application and because of certain design restrictions I have to do it in Flash. This application communicates with another one done in c++, but just because I need a couple strings, so I thought it would be easy to write them to a .txt file and parse it. But the only way I've found so far is adding a browse event handler and select the file manually. That's no good for me, I need the file to be read automatically given a path, something like: var data:ByteArray = fileRef['C

How to get response header using ActionScript? (Flash)

守給你的承諾、 提交于 2019-12-22 12:23:47
问题 So... I have a URL like www.example.com/stream/ I need to make any request to this url and get Http Rewspons header (like this one: HTTP/1.0 200 OK Content-type: video/x-flv Cache-Control: no-cache I do not need reponse body at all. After I get header need to emmidiatly close connection to that url (so stop to obtain data from it) How to do such thing (I use Flash builder) 回答1: Aparently, that's possible in AIR (I've never tried it): http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3