-
why wont flash autocomplete my code?
I've made a class, called mug....
mug has a function/method of breakMug...
but why is it that when i use this in the actions editor...
Code:
var chrismug:Mug = new Mug("Chris","red",false);
chrismug.
as soon as i hit that last . , shouldnt all the methods for the mug class appear?
-
my own follow up
Writing code that triggers code hints
When you work in the ActionScript editor (either in the Actions panel or Script window), Flash can detect what action you are entering and display a code hint—a tooltip that contains the complete syntax for that action, or a pop-up menu that lists possible method or property names. Code hints appear for parameters, properties, and events when you strictly type or name your objects so that the ActionScript editor knows which code hints to display, as discussed in the rest of this section. For information on using code hints when they appear, see Using code hints.
Note: Code hinting is enabled automatically for native classes that don't require you to create and name an object of the class, such as Math, Key, Mouse, and so on.
Strictly typing objects to trigger code hints
When you use ActionScript 2.0, you can strictly type a variable that is based on a built-in class, such as Button, Array, and so on. If you do so, the ActionScript editor displays code hints for the variable. For example, suppose you type the following:
var names:Array = new Array();
names.
As soon as you type the period (.), Flash displays a list of methods and properties available for Array objects, because you have typed the variable as an array. For more information on data typing, see Strict data typing. For information on using code hints when they appear, see Using code hints.
Using suffixes to trigger code hints
If you use ActionScript 1 or you want to display code hints for objects you create without strictly typing them (see Strictly typing objects to trigger code hints), you must add a special suffix to the name of each object when you create it. For example, the suffixes that trigger code hinting for the Array class and the Camera class are _array and _cam, respectively. If you type the following code:
var my_array = new Array();
var my_cam = Camera.get();
and then type either of the following (the variable name followed by a period), code hints for the Array and Camera object, respectively, appear.
my_array.
my_cam.
For objects that appear on the Stage, use the suffix in the Instance Name text box in the Property inspector. For example, to display code hints for MovieClip objects, use the Property inspector to assign instance names with the suffix _mc to all MovieClip objects. Then, whenever you type the instance name followed by a period, code hints appear.
Although suffixes are not required for triggering code hints when you strictly type an object, using them consistently helps you and others understand your scripts.
The following table lists the suffixes required for support of automatic code hinting:
Object type
Variable suffix
Array
_array
Button
_btn
Camera
_cam
Color
_color
ContextMenu
_cm
ContextMenuItem
_cmi
Date
_date
Error
_err
LoadVars
_lv
LocalConnection
_lc
Microphone
_mic
MovieClip
_mc
MovieClipLoader
_mcl
PrintJob
_pj
NetConnection
_nc
NetStream
_ns
SharedObject
_so
Sound
_sound
String
_str
TextField
_txt
TextFormat
_fmt
Video
_video
XML
_xml
XMLNode
_xmlnode
XMLSocket
_xmlsocket
For information on using code hints when they appear, see Using code hints.
Using comments to trigger code hints
You can also use ActionScript comments to specify an object's class for code hinting. The following example tells ActionScript that the class of the instance theObject is Object, and so on. If you were to enter mc followed by a period after these comments, a code hint would display the list of MovieClip methods and properties; if you were to enter theArray followed by a period, a code hint would display a list of Array methods and properties; and so on.
// Object theObject;
// Array theArray;
// MovieClip mc;
However, Macromedia recommends using strict data typing (see Strictly typing objects to trigger code hints) or suffixes (see Using suffixes to trigger code hints) instead of this technique, because those techniques enable code hinting automatically and make your code more understandable. For information on using code hints when they appear, see Using code hints
-
damn...
okay i was wrong... this doesnt apply to classes that i've created...so how the hell do i get it to?
-
its very important that i figure this out
thanks people
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|