flash-cs5

Actionscript object number of properties

女生的网名这么多〃 提交于 2019-12-10 12:56:14
问题 How can I get the number of properties in a generic Actionscript Object? (Like Array length) 回答1: You will have to loop over all element to count them: function objectLength(myObject:Object):int { var cnt:int=0; for (var s:String in myObject) cnt++; return cnt; } var o:Object={foo:"hello", bar:"world"}; trace(objectLength(o)); // output 2 回答2: Even shorter code here: var o:Object={foo:"hello",bar:"world",cnt:2}; trace(o.cnt); // output 2; Just remember to update the very last argument in the

Get current page number in InDesign CS5 from Javascript

我是研究僧i 提交于 2019-12-08 19:32:03
问题 What is the DOM expression to get current page where the cursor is: app.activeDocument.currentPage ? 回答1: You want: app.activeWindow.activePage.name; This will give you the actual page number name as a string (i.e. if your pages are numbered in roman then this will give 'v' for the fifth page). 回答2: The below would create a Text Block with the current page number. You could also have this be applied to the master page by changing the page location for which the text frame is placed.

Make a SWF have a transparent background?

拟墨画扇 提交于 2019-12-08 14:04:05
问题 If I have a one SWF movie imported inside of another, how do I make the inner one have a transparent background? 回答1: SWFs imported will always have transparent background - the Loader object itself doesn't work like, say iFrame in HTML. Unless you have a background in the SWF made up of some graphics, or MovieClips, Sprites, Buttons... whatever else, then you won't see the default backdrop you can see in IDE while working with the FLA file of that SWF. 回答2: try different BlendModes 来源: https

Automate Batch Script - Convert filenames to text in Photoshop

前提是你 提交于 2019-12-08 12:25:03
问题 How do you convert each filename of a bunch of files, each to a text layer (and save) in Photoshop? Folder 1: Hundereds of files Folder 2: Nearly the same files, but each with its filename plastered onto its image Here is a hacked up snippet. The error that I can't seem to get by is how to set the activeDocument to the currently open one. http://pastebin.com/b0fqG9v4 回答1: Hasn't been marked as answered so here's a javascript example for CS (and should work on later versions too) in case

How to access a public array/vector from another class

孤街醉人 提交于 2019-12-08 10:39:53
问题 I have a vector in my Main class file that store objects. I will like to be able to add more objects to that SAME vector from a different class. I gave the vector in my main class the "public" modifier. I now need the syntax to reference it in my other class file public var badChar:Vector.; 回答1: You have options. How you approach it is dependent on your project setup, and the needs of the property. Is it an instantiated object, or should there ever only be one (even if the class is

Select random elements from an array without repeats?

99封情书 提交于 2019-12-08 10:26:09
问题 edit: I can't believe I didn't catch this sooner. Turns out my problem was re-declaring my first variables over and over again, essentially starting the program fresh instead of continuing it. To fix it, I replaced the first two lines with this: if (initialized === undefined) { trace("INITIALIZING"); var MCs = []; var lastPos = "intializer"; var initialized = 1; } Now it works like a charm. I feel like a noob for this one; sorry to anyone whose time I wasted. I'd post this as an answer to my

What is the use of void in AS3

£可爱£侵袭症+ 提交于 2019-12-08 09:06:37
问题 What is the use of void in Action Script 3.0? Can any one give brief explanation with example? 回答1: It's a function type. It means that it doesn't return any data By default Flash always expect to return a value. If you write a function like this for example: ActionScript Code: function myFunction(){ } Flash assumes that returning a value is still possible and so watch for it which uses ressources. When you specify :void you are actually telling Flash to not expect any return value so Flash

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

Include MX library to Flash CS5 project

狂风中的少年 提交于 2019-12-08 02:34:14
问题 I need to use some classes belong to mx library, but when I try to import it Flash throws me an error that it can't find this library. How can I import it to my project? I'm using Adobe Flash Professional CS5. 回答1: You may try downloading the Flex SDK, get mx.swc from Flex\frameworks\lib and add it to your library path (ActionScript Settings > Library Path) in Flash CS5. 来源: https://stackoverflow.com/questions/7913822/include-mx-library-to-flash-cs5-project

How do I detect collision detection in flash AS3?

白昼怎懂夜的黑 提交于 2019-12-07 13:28:54
问题 I wanted to create a maze in flash AS3, with the user guiding the character. I tried using this (below) but this will require me to make all the maze walls individual and setting collision detection to each one. Is there an easier way of accomplishing the same thing? monkey.addEventListener( Event.ENTER_FRAME, handleCollision) function handleCollision( e:Event ):void { if(monkey.hitTestObject(wall)) { trace("HIT"); } else { trace("MISS"); } } 回答1: You can use the Collision Detection Kit :