Is there any way to create foldable regions of code in ActionScript 3 (read this as Adobe Flash CS3 built-in editor). I'm looking for something like in MS Visual studio so that I can do:
#region "Event handlers"
... big list with methods here
#end region
Any ideas?
In the Flash IDE, select the code to fold and right click. A menu will appear with the following options: Collapse Between Braces | Collapse Selection | Collapse Outside Selection | Expand Selection | Expand All.
With that said, you should seriously consider a 3rd party ActionScript development environment, such as FlashDevelop, a very well thought out alternative. It's a massive pain developing in the Flash IDE.
http://www.flashdevelop.org/community/viewtopic.php?t=202
Flash CS4 has a code folding feature. Just select/highlight a few lines of code and click the - icon on the left.
In the Flash CS5 IDE, select the code to fold and right click. A menu will appear with the following options: Collapse Between Braces | Collapse Selection | Collapse Outside Selection | Expand Selection | Expand All.
In Flash CS3, there was not really anything like that. CS4 introduced conditional compiling, not really what you are looking for; but it does not get any closer.
Like already suggested, I would suggest using FlashDevelop. It has some folding options, but event more importently it has intellisense and automatic code generations. And it is free.
Flash CS3 calls it "Code Collapse".
On the editor toolbar:
Flash CS3 toolbar in editing mode http://img19.imageshack.us/img19/4558/picture23s.png
The buttons with facing arrows will collapse code between braces or the current selection. The button with arrows going out will expand code.
You can also find the commands in Edit->Code Collapse, which shows the keyboard shortcuts. Or you can right-click on the code you wish to collapse to get a menu of various actions, among them, collapse options.
If you are using FlashDevelop it has a terrific solution. You can create regions to conclude your code like this:
[-] //{ start region
your code here...
//} end region
and expand like methods
[+] //{ region Public methods
sth. like #region would in CS5 be:
//Controlls
{
public var IWaffe:MovieClip;
public var IWaffeD:MovieClip;
public var ICursor:MovieClip;
public var IFeuer:MovieClip;
}
and then you can use the collapse brackets button.
Related
I have few questions here, regarding creating app in Adobe Air using Starling and feathers.
I created yet a very simple app, which has Feathers list controller with static data provided to its dataProvider. According to the code it should work fine, but there are three major issues I am facing.
1: Touch/Click Positions
I am using:
list.addEventListener( Event.CHANGE, list_changeHandler );
Now the problem is, clicking coordinates are not correct. Clicking on 3rd Item triggered 4th item, to trigger 3rd, 2nd item needs to be clicked it's half way through etc.
2: Nothing, without Theme
I am using a custom theme, came along with a tutorial. If I don't use the theme, I am unable to see anything on the screen, somehow.
3: Resolution (Device Simulator) Problem
Though buggy, but it works with Theme, but my app doesn't fit with the resolution for each device simulator. Either its, iPad or iPhone 4 or any android simulator.
Also, can anyone please also explains, what is significance and use of Context3D render mode in starling class.
Any help is appreciated:
Thanks in advance
Waqar Iqbal
Starling is a Stage3D framework that displays content directly on graphic card using Context3D. Everything displayed by Starling is always under the regular display list. Feather is a component framework based on Starling.
Stage3D cannot handle any mouse operations so Starling and Feather simulate all their mouse event (those mouse event never really happen anywhere, they are created by calculation of mouse position on the stage)
not sure, never used Feather
Starling does not handle screen density and dpi calculation, if you want your app to fit any screen you'll have to handle it yourself.
I think you should see the example carefully. if u want to use any feathers component either you have to use feathers theme or custom theme.
if you use feather theme you need to provide theme path and before using any component you need to initialize that theme.Then use component any where.without theme you will not see any thing.
1: Touch/Click Positions
please provide minTouchHeight in class theme of DefaultListItemRenderer like:-
renderer.minWidth = this.gridSize;
renderer.minHeight = this.gridSize;
renderer.minTouchWidth = this.gridSize;
renderer.minTouchHeight = this.gridSize;
2: Nothing, without Theme,
3: Resolution (Device Simulator) Problem
Follow the example given in feather library
feathers-2.1.1\themes\MetalWorksMobileTheme\source\feathers\themes
I'm new to Actionscript.
Someone gave me a .FLA file. I opened it up in Adobe Flash Builder, then pressed Debug>Debug from the menu bar and the project starts running in a flash player as expected.
Then I shut down the flash player and then I wanted to start editing the project.
I go to the canvas area and see nothing but a purple background. I go to the timeline and see one empty layer.
I see in the library a lot of pictures and movie clips. But none of them seem to have action scripts associated with them.
Where do I go to look for all the actionscript that powers this app? I'm pretty sure there is some actionscript involved...but have no idea where to look at this point.
I typically click on a layer/frame then right click and choose actionscript to open up the actionscript dialogue window. But it's always empty.
---- EDIT
I noticed there's a folder src/com/gsk/proj1/myawesomeproject/ . In that are the folders controllers, controls, models, views and a few more. How does the flash project know to read action script from somewhere in this folder? And which as file is fired first?
Look in the following places for code associated with an FLA:
Open the Window > Actions panel and look on the left side drawer (expand it if not showing). This will show the location of all "timeline scripts" embedded in the FLA.
Look at the Properties panel for the main timeline (click on an empty area if necessary to de-select any objects) and look at the "Class" field. This is the root "document class", and if not empty, this class will be instantiated along with the SWF when it is constructed by the player. Of course, that class could be using all sorts of other classes, but it would be the entry point for the SWF.
In the Library panel, look for symbols who have a Linkage value. This indicates the symbol is linked to a class by that name. Open the symbol properties (right click > Properties) for more details. Note that Flash can "auto generate" classes that don't have actual class files (useful for instantiating display objects strictly for visual purposes).
I have an application for kind of like a homemade microsoft paint made completely in AS3, I am not that advanced in actionscript, but I will ask you my question and thank you in advance!
So I have buttons, each button is a drawing tool, and I want the icon for the drawing tool(button) to be something different than when it is up, down, roll, hit. A compleletley different image to appear ontop of the current button so the user knows what tool is in use while they are using it..
What would be the easiest way to do this with AS3, the timeline and use of movie clips?
Thanks!!
You want to define your button as an instance of SimpleButton, then set the images directly. Kind of like this:
var clearBtn:SimpleButton = new SimpleButton();
clearBtn.upState = mc2;
clearBtn.overState = mc2a;
clearBtn.downState = clearBtn.upState;
clearBtn.hitTestState = clearBtn.upState;
Which I took from a similar question / answer posed on the adobe forums.
If you have these buttons as MovieClips - just change their type to Button in the library. Each button has four keyframes 1- default state, 2 rollover, 3 hit and 4 hit area.
That's the easiest solution without coding.
So, I'm pretty much a beginner in Flash and Actionscript (using AS3, as I said in the title), and I'm trying to make a basic escape the room game. I haven't gotten far, and right now that's because every time I test my game (or publish preview it) the graphics get this annoying outline. Here it is when tested: http://i305.photobucket.com/albums/nn228/chokingondrama/flash.png
Every outline corresponds to some object present in the game, most of which have an alpha component of 0 since they're on different sides of the room. This didn't happen before, but once I added the code that allowed the player to change their view with the arrow (each viewpoint/wall is a different frame) these appeared.
It's a little different when published to HTML, basically it just gives each image a white background: http://i305.photobucket.com/albums/nn228/chokingondrama/html.png
Also, it would be nice if somebody could give me advice on how to make sure importing to flash won't result in lower quality.
Thanks in advance. If needed, I'll post any part of the code.
Some tips:
Don't set alpha to 0, instead use the visible property, setting movieclip.visible = false will make it a lot more efficient.
As for the importing and quality, after you import to stage or library, bring up the library (ctrl + l), and right click on the file you imported, go to properties. If it's an image, set compression to lossless, and allow smoothing.
For audio, go to file-> publish settings, and change audio stream and audio event (whichever you might use) to 128kbps.
As for your main question, I need more info, if you want you can post your source. It might be because of how you are placing your graphics on the stage.
For each of your MovieClips in question:
Try disabling button mode and see if the rectangles go away.
movieClipName.buttonMode = false;
If that doesn't help, or you really want button mode, try setting
movieClipName.tabEnabled = false;
There's a chance that since you added keyboard interaction each of your MovieClips are now expecting to be selected by the user when they press the tab key, much like any normal web form.
tabEnabled in the docs
You could also try
movieClipName.focusRect = false;
focusRect in the docs
Our project is a MMORPG, using scaleform to render UI. Now we use Flash CS5 to create UI panels with scaleform CLIK. With the development of this project, we encountered some problems:
CLIK is not skinned, we have to create separate symbols for each component with different disappearance, so we have PushButton1, PushButton2, RadioButton1, RadioButton2...
Flash CS5 is not a What You See is What You Get tool. For instance, we have a shared component named Window, it has a close button as it's child. In a fla, we first pull a Window on the stage, and modify its size, the close button will be scaled in the stage.
We can constrain the close button in as code, but artists have to see the right result in Gfx Player on runtime.
We have some common components fla like common_button.fla with most of button components in it. Common components are runtime shared in different fla. In a UI fla (e.g. friendpanel.fla), when we need a common component, we copy it from common_xxx.fla and paste it in the new fla library. If a panel is complex, it's library will be confused and not easily managed. If the common one is not satisfying requirement, we will double-click the pasted component and modify it in the local fla, and this caused more resource management troubles.
So I consider if we should create a skinned UI component lib and an UI editor to handle this problems. Does any one has similar experience?
These are common workflow problems reported by many Flash IDE users unfortunately. Certainly, creating your own tool to solve these problems is a good option, but a costly one. The Scaleform team is investigating possible solutions to these types of issues for future versions of the SDK. In the meantime, there's not much that can be done to remedy these issues that I am aware of.