actionscript

In as3 adjusting brightness of the shape is not working via coding

霸气de小男生 提交于 2019-12-08 03:56:23
问题 This is my following code. var clips:Array=new Array(clip_0_mc,clip_1_mc,clip_2_mc,clip_3_mc,clip_4_mc); trace(clips); clips[0].alpha=.5; clips[3].rotation=45; clips[3].brightness=100;// This is not working. clips[1].rotation=170; I tried alpha and rotation tat is perfect. but brightness is not working. 回答1: Well there is no brightness property for MovieClips so that is not surprising. You can use ColorTransform with fl.motion.Color to change brightness. import flash.geom.Transform; import

Simple flat shading using Stage3D/AGAL

我的梦境 提交于 2019-12-08 03:49:28
I'm relatively new to 3D development and am currently using Actionscript, Stage3D and AGAL to learn. I'm trying to create a scene with a simple procedural mesh that is flat shaded. However, I'm stuck on exactly how I should be passing surface normals to the shader for the lighting. I would really like to just use a single surface normal for each triangle and do flat, even shading for each. I know it's easy to achieve better looking lighting with normals for each vertex, but this is the look I'm after. Since the shader normally processes every vertex, not every triangle, is it possible for me

Flex/Actionscript : How to change property (label) of all buttons?

谁说胖子不能爱 提交于 2019-12-08 03:29:53
问题 I'm new to Flex/Actionscript and have a very basic question. Let's say I have about 100+ buttons. They all have the same label. Now I want to change the label for all with a click. I could give them IDs and then run a for loop, but I'm searching for a neater solution. Thanks for help. Update: Hm, it doesn't work because label of buttons are modified during the run time. This is the code public function changeButton(event:Event):void { if (event.target.label != 'X') { event.target.label ='X';

Get dimension of locally loaded large image

柔情痞子 提交于 2019-12-08 03:00:27
问题 I'm trying to read the width and height of a locally loaded image. This seems to work for images that do not exceed the dimensions limited by the Flash Player 10 (http://kb2.adobe.com/cps/496/cpsid_49662.html), but as soon as the images are bigger, the width and height remain 0. The strange thing is that now and then, I can read the dimension of these bigger images, but most of the times not. I understand that this might be because of the player limitation, but then I would at least expect

URLLoader gets stuck when polling

非 Y 不嫁゛ 提交于 2019-12-08 02:22:06
问题 Update: somehow this works when running flash in browser, but doesn't work if you run from IDE. You might want to try running in browser if you have the same problem. I am making a chat application that repeatedly reads a text file from my server using Flash & Actionscript 3.0. I am opening the file with URLLoader, and it works fine at first. However after around 10 calls, the URLLoader gets stuck. It does not give a completion event, does not give a security error, does not give a status

Adding the replaceAll method to the ActionScript String class

☆樱花仙子☆ 提交于 2019-12-07 21:43:27
I need some help in adding the replace all functionality into my Flex project. I would prefer doing this in a way that is as natural as possible. What I want to achieve is to be able to run this code (with the Flex compiler) "aabbaaba".replaceAll("b","c") and get "aaccaaca" . Also I want to chain replaceAll calls. Note: I won't be actually replacing b s with c s, but various string that will not be known at coding time! What I don't want: 1. Use regular expressions with the global flag. The tokens to replace are determined ad run time and transforming them into a regular expression isn't

Create image from data-in-uri (base64-encoded PNG) in ActionScript

前提是你 提交于 2019-12-07 21:15:20
问题 I have a string of of base64-encoded PNG image that is suitable to use as a src (source) attribute in a <img> tag. However I need to transfer this image to Flash applet where I need to create (show) the image fast . Is there a way to simply use the data string and somehow create an image (inside a Flash movie) from it? Performance of the operation is a core requirement. 回答1: At the very least you must decode the base-64 data into binary. You can then load the binary data as an image using

How to get a bytearray from file stream in Adobe AIR?

江枫思渺然 提交于 2019-12-07 20:18:13
问题 I read limited (small - 15 - 500 mb files). I need to be able to put all file bytes into one single bytearray. So I have a function: [Bindable] public var ba:ByteArray = new ByteArray; //.... code ....// protected function fileOpenSelected(event:Event):void { currentFile = event.target as File; stream = new FileStream(); stream.openAsync(currentFile, FileMode.READ); stream.readBytes(ba); stream.close(); MyFunction(ba); } But it does not work=( - gives me Error: Error #2030: End of file was

Accessing .NET Web Service securely from Flex 3

我只是一个虾纸丫 提交于 2019-12-07 17:56:51
问题 We can successfully consume a .NET 2.0 web service from a Flex/AS3 application. Aside from SSL, how else can we make the security more robust (i.e., authentication)? 回答1: You can leverage ASP.Net's built in session management by decorating your webmethods with <EnableSession()> Then, inside your method, you can check that the user still has a valid session. 回答2: If you're talking about securing the information going over the wire, you can use Web Service Extensions (WSE) to encrypt the body

In Ruby, is there a way to accomplish what `with` does in Actionscript?

不羁岁月 提交于 2019-12-07 17:51:59
问题 In Ruby, I would like to select a default object for a block. An example in Actionscript is: with (board) { length = 66; width = 19; fin_system = 'lockbox'; } Which is equivalent to: board.length = 66; board.width = 19; board.fin_system = 'lockbox'; Here is the documentation for this statement in Actionscript: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/statements.html#with How can I accomplish this in Ruby? 回答1: Hash.new.tap do |h| h[:name] = "Mike" h[:language] = "Ruby" end #=