ActionScript 3.0 :: Totally Pointless Naming Convention
Mar 31, 2010
When you're working with a class that has both a private and a public function by the same name (something like playVideo())? Often my public playVideo() function only provides a hook to the real private playVideo() function, which will contain more functionality. Should I use an underscore in the private version -- _playVideo() -- or is there some better way to do this?
I know it's a matter of preference and there really is no right or wrong way, but I haven't been naming all of my private properties with the underscore so it seems odd to start now with only *some* of them. This sort of trivial thing has bugged me for a while, so I finally decided I should get it settled.
View 6 Replies
Similar Posts:
Feb 17, 2011
This is not a technical question, just out of curiosity, why do we usually use the reverse domain naming convention for packages? i.e. com.yourname.yourpackage.class
View 2 Replies
Mar 24, 2012
I have seen lot projects following this kind of coding style
Any significant advantage the following syntax
My project name : King Author(KA)
I am going create button components. My class name "KAButton"
Is it right approach and what about namespace?
naming convention for GUI components(Flex/Html) ?
View 3 Replies
Mar 17, 2009
I am looking at a sample sliding image flash file that uses setInterval and rollOvers etc. I noticed that the author named his instances as numbers which isn't allowed. I don't even understand how he was able to do it unless he used an older version of flash. CS won't let you name an instance starting with a number.
He has 5 instances on the main timeline all named "1" thru "5". I figured I would try to rectify the problem by changing the actions and of course changing the name of the movieclips to "mc_1" thru "mc_5". I ran into some logic problems because his script relies on using the _name property of the clip in order to correctly select the active button when the user rollOver it.
For example, if I rollOver the 3 button the rollover = this._name property apporiately equals "3" which is simple. But when I tried to change it via a variable so that it equals "mc_3" well I have run into a problem because obviously 3 is a number while mc_3 is a string.
Here is the original code:
Code:
image_slider.onEnterFrame = function() {
var _counter = this;
_counter.x_target = -(rollover - 1) * 352 + 576;
[Code]....
View 1 Replies
Sep 21, 2010
I see examples in the SWFAddress documentation, but it's not clear what the convention should be for a multi-level path. Do their examples intend to suggest that the path separator should be a hyphen?
View 1 Replies
Oct 28, 2011
I wonder if it is posible to create a new variable in actionscript like this...
ActionScript Code:
//create a new variable
var ["new_var_" + myNumber]:Array = ["hello, hey, more_silly_stuff"];
//putt my new variable inside my old Array
row[myNumber] = ["new_var_" + myNumber];
If you understand what I want to do, is it in some way possible to acomplish this?
View 9 Replies
Jun 13, 2010
So, I popped open up Flash CS5 just now, and I couldn't find my projects panel. I was working on a dual screen set up previously, so my windows were everywhere anyways (sans external). I switched over to a smaller screen workspace, and popped opened the projects panel. Oddly enough, the code snippets panel came up instead. So, I switched off the code snippets, and tried again. I've been trying different ways of opening this panel for about 15 minutes, and I'm totally stumped. Some thorough googling didn't present any relevant results, so, StackOverflow, I turn to you. Is this a known issue? is there a secret backdoor way to open this panel?
View 1 Replies
Jun 16, 2011
I am working on a project that plays a sound when the mic input does not detect any sound.When I close the preview in flash I get no error but flash cs5 totally crashes.I suspect the computer cash fills up with the information about the mic input and can't handle it anymore so crashes,but I am not sure and don't know how I could fix this. I do know when the animation_mc.play(); is removed it does not crash.(In my animation_mc are the audio files that should be played when the mic does not detect an input.)
Here is my main code
Actionscript Code:
var verdergaan = false;var mic:Microphone = Microphone.getMicrophone();mic.gain = 50;mic.rate = 8;mic.setLoopBack(true);mic.soundTransform = new SoundTransform(0, 0);mic.setSilenceLevel(20,
[code]...
View 1 Replies
Mar 23, 2010
I have a .fla that contains five movieclips, and have a couple of questions regarding removing movieclips and swf size.If all the movieclips are displayed, my resulting swf is about 50k.If, in frame 1, I code conditionals that decide which of the movieclips will be displayed, will the resulting swf size become smaller if some of the clips aren't displayed?If so, what is the correct way to totally remove a movieclip from memory? Say I have a main movieclip that contains 5 other mcs, and the as code is within the main movieclip.If not, is there a way to make the swf size smaller if less than all clips are displayed (using conditionals).
View 10 Replies
Apr 10, 2010
Attached mcs from library are totally different sizes.I'm attaching them for my gane but they are totally different sizes. If I scale them that doesn't help because then the big ones become too small.If I fix their size and width some look ridiculous.Is there anything I can do?
View 2 Replies
Jun 27, 2011
I would like to create an totally re-sizable application using Flex 4.5. I experimented already but my approach seems to be hard to maintain so it does not look good to me. Here is my approach:Concerning the HTML I actually have a first page which detects the user's monitor resolution and then redirects to the flash container HTML(a JSP) which reads the width and height parameters and renders the flash to the size passed.In my application I used the 1280x720 as the reference size so I have created a utility class:
package utils
{
import mx.collections.ArrayCollection;[code].....
I pass the percentage value relative to height or width and I get back just that. So I actually bind the height/width of components to e.g {LayoutUtils.relativeToWidth(50)} which would return 640 if my applications width would be 1280. But this means setting width and/or height to almost every component and this includes also padding and anchor positions which makes it a mess. I want everything to be re sized correctly(including fonts). All the available sizes I am going to have available will keep the same aspect ratio which is going to be 16:9 for example because I can't see any other way of doing it
View 1 Replies
Feb 22, 2009
We are using PopUpManager to bring some screens up, and every time I create one, I need the new one to be totally unique from the old one. Right now, every time I create a popup, it has cached the last one in memory somewhere, and the variables are all still set.
View 0 Replies
May 30, 2011
I'm trying to build a simple timer application in as3 that counts down and then plays a gongsound. easy right?There are 3 buttons that should change the time from 2,3 and 4 minutes. Default time is 3 mins but the buttons never change the time and I can't figure out why, the trace tells me the boolean values have changed but the time is always the same..To save time I changed the times to 3,5 and 7 secs. here is the code :
ActionScript Code:
//time selection buttons
var time;
[code]......
View 6 Replies
Mar 11, 2003
So I am tring to load a movie into a target. It is loading but all of the scripts are not working (some of the scripts are working). All the scripts work if I load the movie to a level instead of a target. But I need the movies to be in a target because of the motion that I want to apply to the loaded movie
View 1 Replies
Dec 4, 2010
i developed a social network using flash (actionscript 3) , php and mysql and it interest in some fields of science.i would like from you to test it (if you find any mistake please tell me)
View 1 Replies
Feb 24, 2012
I have a banner ad which contains an flv player. Due to size restrictions for banners at the site, I've found a player which I think will do the trick (chrometaphore). However, the site in question does not allow anything more than the actual swf for the ad, so I cannot include the com folder for the player and need to include all AS3 code in the swf file. I'm not a scripting genius, and wonder what it would take to include all the classes in the AS3 file contained in the swf. Is it possible? Does anyone know where I can find a VERY lightweight player whose entire code is contained in the fla?
[edit]: It just occurred to me that if the flv is on a remote server, could the com folder and files also be remote? Currently, the path for the com files looks like this:
import com.chrometaphore.display.video.colibri.Colibri;
import flash.media.SoundTransform;
What would that script look like if it was pointed to a remote com folder?
View 1 Replies
Oct 23, 2009
I have several buttons wich loads movies into a movieclip. When you hit once, it takes 1,5 seconds when the flashy makeup is final and the content is visible.When i hit a button 2-times the website turns into a epilepsic repeated load.
Check the code:
/* a node in the tree has been selected */
treeListener.change = function (evt:Object) {[code].....
I want to freeze my animation totally during processing, so that:
1: click 2: processing, takes 1.5 second (button is disabled) 3, after 1.5 second: finished (button is enabled)
View 6 Replies
Mar 23, 2010
I have a large creation in process that requires a lot of heavy animations and movement with vectors and really processor intensive. Just want to know, regardless of whether the project is huge or small, how to totally stop a class from working? I have three classes I am calling. "class1 = new Class1();" etc. When I am in the level, say, class2, I can still talk to objects in class1 even though I removed the class listeners within that class1 after I was done using it. It still is able to be called upon, and still running something in the background that I can't figure out what it is. I just want to know, rather than searching for whatever is causing the problem, can't I simply null the class that I never ever need to use again?
I tried that, but then I ran a trace and it still tells me that it is a class object. I reckon its because I have a "public var class1:Class1" etc, which means they will always have those objects associated with them, but still. I want to totally get rid of it for garbage collection, and because I don't want to use some of them at all, ever again. So basically, what is the best way to get rid of classes so that they aren't hogging up resources any more?
View 2 Replies
Feb 10, 2010
I have simple combobox component in flash cs4, I try to add and event listener like this
mycombo.addEventListener(Event.ADDED_TO_STAGE, added);
function added(e:Event):void
{
trace("HI");
}
never get called even if I have the component in the stage manually or via AS, but if I add a listener to MouseOver it works, why the ADDED_TO_STAGE event don't work, also I have a problem with the textFormat style if I use
mycombo.setStyle("textFormat", tf);//suppose tf is a TextFormat object
doesn't work too, but if I put that line inside the MouseOver event it work's why??
View 1 Replies
Mar 22, 2011
I am working on a video player in Flash CS4. I'm trying to build the player such that when the user moves their mouse over the flash object, the playback controls appear and, when the user moves the mouse out of the flash object, the controls disappear.I managed to get some code put together that works in every browser but one: Internet Explorer. Well, it 'works' but only if you slowly move the mouse out on the left side of the flash object.I have done quite a bit of Google searching for an answer, but I can't seem to find someone with a similar problem.Code is as follows:
ActionScript Code:
root.onLoad = function(){
_root.clip.skinAutoHide=true;
[code].....
View 1 Replies
Apr 5, 2010
im using this code for my movie to pause for a certain time and then it play every after 5 seconds
stop();
var nInterval = setInterval(Play, 5000);
function Play() { clearInterval(nInterval); gotoAndPlay(_currentframe+1);}
[code].....
View 8 Replies
Mar 15, 2012
My question is simple: is "Shape tween" the only way to animate two totally different colors, say, for ex, green to red?
View 7 Replies
Aug 26, 2009
Code:var StringMine:String = "hello";And i want to use the value of that string, 'hello' to name a new variable, i thought like this,Code:var [StringMine]:String = "One";but not supprisingly, it doesnt work...
View 2 Replies
Mar 11, 2010
I thought that there was a way to be able to name array indexes. Like instead of myArray[0], it could be myArray["tileFour"]. I thought that instead of using index numbers one could use index words.
View 1 Replies
Jul 25, 2011
i have an array of coins that are layed out on a map for a character to come pick up.i have the coins displaying on screen but i cant get a simple hit test to work. it only seems to work on the last coin created, i presume because the 'i' value hasnt been appended to the name. i knew how to do this in as2 but dont know the syntax for as3. ive attached the file for you to have a look at.
code:
rectangle_mc.startDrag();
rectangle_mc.x = mouseX;
rectangle_mc.y = mouseY;
[code]...
View 4 Replies
Dec 13, 2009
loader is display object but I could not set name to loader. In the documentation loader does not have property of "name". How to set name for loader instance. Example
var imgColl:Array=new Array("1.jpg","2.jpg");
var i:Number=0;
while(i<tot){
[code]....
View 2 Replies
Aug 8, 2011
is it possible to add variables and name them according to position in a loop? for example how can I do something like this:
[Code]...
View 5 Replies
Apr 18, 2005
I need to change porperites on MC that is in a MC I just attached something and for some reason I can't seem to find out how to get an instance name into them or to just use the one thye have in the library.
View 7 Replies
Feb 5, 2009
I have created a function to load up my movies what I would like to do is two things
(i) change the ldr to a movieclip
(ii) add an extra parameter to add an instance name movieclip when I call the movieclip
loadMyImage('images/headers/logo.png', 80, 20 );
function loadMyImage(imageURL, xPos, yPos) {
var ldr:Loader = new Loader();[code]....
View 4 Replies
Sep 23, 2009
Ok, I've been climbing the walls trying to figure this out, looked everywhere for an answer, learned a few bits and pieces along the way, but still can't do it.I've made my Class which is a little movieclip called 'block', it's fine and does what I tell it to do ie. I can reposition itstretch itotate it and stuff.The problem is.. I want to make more of them and reference them individualy so I can change the properties of them individualy ie, the x and y values etc.
for (var i=0; i<2; i++){
var newBlock:blocks = new blocks();
this.addChild(newBlock);
[code].....
View 6 Replies