actionscript

Save a variables value into a existing .txt file with actionscript 3

浪尽此生 提交于 2019-12-11 18:35:06
问题 i want to save the value of a variable into a existing .txt file. i have fixed it in some way, but instead of save it into a existing file, it creates a new .txt file everytime... please help me... here is the code: var file:FileReference = new FileReference(); var ba:ByteArray = new ByteArray(); ba.writeUTFBytes(total); //save into drive file.save( ba, "register.txt" ); Please help me! 回答1: Looking at the documentation for the save method: http://help.adobe.com/en_US/FlashPlatform/reference

Actionscript: resizing bitmapdata with smoothing

强颜欢笑 提交于 2019-12-11 18:09:09
问题 var bd:BitmapData=new BitmapData(file.width,file.height); bd.setPixels(new Rectangle(0,0,file.width,file.height),file.raw); var scale_x_percents:Number = (w / bd.width); var scale_y_percents:Number = (h / bd.height); if(!stretch) { if(bd.width*scale_y_percents>=w) { scale_x_percents=scale_y_percents; } else if(bd.height*scale_x_percents>=h) { scale_y_percents=scale_x_percents; } } var matrix:Matrix = new Matrix(); matrix.scale(scale_x_percents,scale_y_percents); var resizedBd:BitmapData = new

Synchronization in ActionScript

允我心安 提交于 2019-12-11 17:56:53
问题 Despite my best efforts, I am unable to produce the kind of synchronization effects I would like to in ActionScript. The issue is that I need to make several external calls to get various pieces of outside information in response to a user request, and the way items will be laid out on the page is dependent on what each of these external calls returns. So, I don't care that all of these calls return asynchronously. However, is there any way to force some amount of synchronization on

Trying to load remote images into a flash sideshow

喜欢而已 提交于 2019-12-11 17:27:34
问题 Trying to load remote images into a flash sideshow local files work even if I use absolute path. I am updating existing gallery to dynamically pull images from Picasa. The php works fine and pulls the images from the API. http://domaineseattle.com/gallery/FlashPhotoStack_SRC/gallery.php But when I pass the XML to flash it wont load remote images. I added System.security.loadPolicyFile("http://photos.googleapis.com/data/crossdomain.xml"); to ActionScript but it still wont work. The scrip for

Check transparency

*爱你&永不变心* 提交于 2019-12-11 17:16:28
问题 I have swf file(900x600) and main part of that file is transparense. So I want by clicking in swf file know either user clicks on transaprent part of image or not... I can get mouse coordinates by event.localX event.localY So how to know in clicked part swf is transparent or not? 回答1: First of all, be sure, that you have some transparent sprite on background of your swf - otherwise you won't receive event. Second, do not use pure local coordinates, they can contain local coordinates of

Chrome AS3 URLLoader different behavior on network error

风格不统一 提交于 2019-12-11 17:03:58
问题 In Chrome upon network error, the event object in error handler is behaving differently than IE and flash player (i.e. directly running the swf, not from the browser). Consider the following test code : private function loadData():void { var loader:URLLoader = new URLLoader(); loader.addEventListener(IOErrorEvent.IO_ERROR, onError); loader.addEventListener(Event.COMPLETE, onColmplete); loader.load(new URLRequest("http://www.jsfbjdsssde.com")); debugField.text = "loading"; // this is a

ActionScript: pushing a closure onto the event stack?

為{幸葍}努か 提交于 2019-12-11 15:56:17
问题 On occasion, I have wanted to push a closure onto ActionScript's event stack so that it will be executed after the current event handler. Right now I use setTimeout(closure, 0) . Is there a more direct way of doing this? 回答1: setTimeout(closure, 0) is creating a new event stack. I don't understand your objective if this solution isn't working for you. What is the goal you're trying to accomplish? Flex has ENTER_FRAME events, Timer, callLater, setTimeout, setInterval, all which delay calls and

RadioButton functionality in custom component

耗尽温柔 提交于 2019-12-11 15:00:11
问题 I am trying to create an xmxl component which contains an image and a radio button. The main application script will use several of these components. I am having problems trying to get the RadioGroup to function properly. I have binded a variable on the RadioButton groupName attribute in the component mxml file so I can set this in the main application script. This functions properly as when I tab through each RadioGroup, only the first radiobutton of each group gets the focus. But when I

Actionscript, getting stage.stageWidth after an orientation event

瘦欲@ 提交于 2019-12-11 14:59:53
问题 I am detecting an orientation change using flash.events.StageOrientationEvent.ORIENTATION_CHANGING Each time orientation occurs two events occur, event.beforeOrientation event.afterOrientation However, after event.afterOrientation the stage.stageWidth property remains the same. Is it possible to detect a orientation complete event, so I can then get the new stage width property. I am hoping such an event exists as otherwise I think I must detect the orientation state and work out if the width

want to remove warnings:

百般思念 提交于 2019-12-11 14:56:21
问题 I am facing a problem as Duplicate variable definition while compiling but it is not at all effecting my program. Is there any way to remove compiler errors beacause it is coming every time when i run movie. 回答1: Remove the duplicate variable definition. I suspect that you are doing something like the following: function foo() : void { for(var i:uint=0; i<10; i++) { // do stuff in here } for(var i:uint=0; i<10; i++) { // do stuff in here } } This will complain about duplicate variable