actionscript-3

Load image of size greater than 2880 in Bitmap

别等时光非礼了梦想. 提交于 2019-12-25 15:56:34
问题 I am using bitmap to load the image, if the image size is more than 2880 h/w I am getting an error. BitmapData src = new BitmapData(canvasToPrint.width,canvasToPrint.height)(canvasToPrint.width, canvasToPrint.height); src.draw(_designArea); // -- encode the jpg var quality:int = 115; var jpg:JPEGEncoder = new JPEGEncoder(quality); var byteArray:ByteArray = jpg.encode(src); if canvasToPrint.width > 2880 or canvasToPrint.width > 2880 I will get below error at line 1 Error : invalid Bitmap To

Load image of size greater than 2880 in Bitmap

做~自己de王妃 提交于 2019-12-25 15:55:42
问题 I am using bitmap to load the image, if the image size is more than 2880 h/w I am getting an error. BitmapData src = new BitmapData(canvasToPrint.width,canvasToPrint.height)(canvasToPrint.width, canvasToPrint.height); src.draw(_designArea); // -- encode the jpg var quality:int = 115; var jpg:JPEGEncoder = new JPEGEncoder(quality); var byteArray:ByteArray = jpg.encode(src); if canvasToPrint.width > 2880 or canvasToPrint.width > 2880 I will get below error at line 1 Error : invalid Bitmap To

AS3 - Merging XML Files

主宰稳场 提交于 2019-12-25 15:15:09
问题 I'm creating a trivia game is Flash (AS3) with two different categories. The player can choose one category, or the other, or both categories together. In the code below I'm trying to merge the two xml files together into a new xml file if the person selects both categories. I'm getting an "Access of undefined property error for myLoader and myLoader2 and I don't know why. // start loading of questions public function xmlImport() { var myLoader:URLLoader = new URLLoader(); var myLoader2

Resizing div with js from flash makes flash appear to freeze in chrome?

三世轮回 提交于 2019-12-25 13:07:16
问题 I have flash resizing it's container div by using external interface to call the javascript: function expandbottomNav() { document.getElementById('bottomNav').style.height = '400px'; } function shrinkbottomNav() { document.getElementById('bottomNav').style.height = '31px'; } Now this appears to work fine in every browser except chrome. For some reason after the div is shrunk back down to size, the flash player looks like it's frozen. It's actually not frozen because if you resize the window

Adobe AIR - Garbage collection and system.gc()

社会主义新天地 提交于 2019-12-25 12:42:26
问题 I'm building an Adobe AIR desktop app with Flash CS5 that makes a lot of use of bitmapdata, bytearrays and base64 strings. After a while the memory usage of the app doubles. Is it recommended to use system.gc() to free memory at that point or is that bad practice? Thanks. 回答1: system.gc is a debug only functionality in AIR and Flash player. I think the better thing is to recycle bitmapdata and other objects if you can to avoid gc, and if not call bitmapdata.dispose() and bitmapdata = null as

create variable from array actionscript 3

大城市里の小女人 提交于 2019-12-25 12:42:04
问题 I'm currently trying to make a dynamic menu via an array and a loop. So when someone clicks on the first item of the array, "menu_bag_mc" it will link to the content "menu_bag_mc_frame" (or some name that will be unique to this array) that is another movieclip that will load. Below is the code I have so far: //right here, i need to make a variable that I can put in the "addchild" so that //for every one of the list items clicked, it adds a movieclip child with //the same name (such as menu

Select random item from an array with certain probabilities and add it to the stage

女生的网名这么多〃 提交于 2019-12-25 12:14:07
问题 Its quite a big task but ill try to explain. I have an array with a list of 200 strings and I want to be able to randomly select one and add it to the stage using code. I have movieclips exported for actionscript with the same class name as the strings in the array. Also, if it is possible, would I be able to select the strings with predictability such as the first has a 0.7 chance the second a 0.1 etc. Here is what i have currently var nameList:Array=["Jimmy","Bob","Fred"] var instance

When using object-oriented programming in as3, is it okay to put some code on the timeline?

醉酒当歌 提交于 2019-12-25 10:09:06
问题 I am just getting into object oriented programming, and I was wondering, is it okay to put some code on the timeline, like stop(); and mouseclick events for moving frames, or should all this be on separate files also? If they do belong in other files, how would I go about doing that? 回答1: MPO is that you should learn the tool as the tool. I think that the timeline is the very best part of Flash, and if you throw that away, you are making your life harder for no good reason. I think all tools

Submitting scores from AS3 to PHP/SQL - #Error 2101

本秂侑毒 提交于 2019-12-25 09:43:36
问题 I was having problems posting scores from a Flash CC AS3 game to a PHP page with SQL database . I was receiving ERROR #2101 messages in my output window. After a lot of time searching this problem I was advised to check if PHP was the problem. I have created a very simple Flash file, the code (I have replaced my actual site address below) is : import flash.events.MouseEvent; import flash.net.URLRequest; import flash.net.URLVariables; import flash.net.URLLoader; import flash.events.Event; var

As3 When i use Loader,i always get httpstatus code 200 event though the httpstatus code in google chrome is 304

主宰稳场 提交于 2019-12-25 09:41:28
问题 In As3, I use _loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHttpStatus); to detect the httpstatus code of Loader . In the callback function the httpstatus code is 200 when the httpstatus code show in google chrome is exactly 304. 回答1: In reality, that should be the same thing because these status are reponses to your request sent by the web server, but with Flash while the requested file is in the cache, you will get always 200 HTTP status because in this case the