Actionscript3 :: Flex - Widespread Are Naming Conventions?

Aug 30, 2010

In 90% of the example projects I see for ActionScript / Flex I notice the following two coding conventions: 1) private member variables with getters/setters start with an underscore as in "_credentials" and 2) interfaces start with the letter "I" as in "ISessionInfo" Coming from the Java world, I find both of these conventions unnecessary and annoying. I am about to start a new Flex project and was planning on NOT following these conventions unless they are truly are widespread, standard conventions in the Actionscript/Flex world.

View 1 Replies


Similar Posts:


Flex :: MXML Id Property Naming Conventions / Best Practices

Nov 3, 2010

Since there's so much potential pollution within namespaces, particularly with the parser automatically declaring any MXML component with an id to be publicly-accessible using that ID I'm finding it dangerous to use just camelCase for MXML element ids. eg:

[Code]...

In Flash development, a lot of us did this for (automatically) declared stage instances like "mcMyTabBar" or "navMC" or "playPauseBTN". I'm looking for input from the Flex community about this. Am I just overthinking things? All of the related Style Guides and best practices documents I've read on the topic just say "use camelCase for ids, and make sure the id property is the first property". What's your take?

View 2 Replies

ActionScript 3.0 :: Naming Conventions For Event Listeners?

Jun 15, 2009

What are your guidelines for naming event listeners?

I seem to go back and forth between...

1. Naming the listener by the action that calls it:

Code: nextBTN.addEventListener(MouseEvent.CLICK, nextBTNClicked); 2. Naming the listener by what it will do after the event:

[Code]...

View 6 Replies

ActionScript 3.0 :: Naming Conventions For Reference Variables?

Mar 25, 2010

If you have ClassA and ClassB, and ClassB contains a variable that references an instance of ClassA, what naming convention do you use for that variable in ClassB?I have used "classAReference" and "rClassA".

View 7 Replies

Array's And MovieClips - Use The Naming Conventions Of An Array?

Nov 18, 2009

I received help on this site on this info-graphic im doing and the solution was to use an "array" which im not familiar with at all. the person that helped me added the following code that worked:

var city_arr:Array = new Array("louisville");//filll that array with all nedded cities//make all the boxes invisible at startfor (i=0;i<city_arr.length;i++){    var [code]...

since i dont know how to use arrays im stuck. i need to add at least 30 more cities to my info-graphic but don't know how to use the naming conventions of an array.Only one of the houses works (when you click on it a pop-up appears, is draggable and has an x to close the pop-up)

Attachments:
relocation_working.fla.zip (975.1 K)

View 1 Replies

Flex :: What's The Difference Between MXML And Actionscript3

Sep 4, 2010

what's the difference between MXML and Actionscript3 when we need to use MXML ??

View 2 Replies

Flex :: Convert A Birthday String Into Age In Actionscript3?

Mar 29, 2011

For example if I was given the string "01/01/1980". How could I then get the current date, then figure out how old someone is, and then just return how many years old they are?

I saw a topic on this in C++ but i'm not to familiar with it, anyone know how this would be done in AS3?

edit: I think what i'm having the hardest time with is how I would break down the original brithday string i'm starting with into month, day, year vars

View 4 Replies

Flex :: Use VGroup Or HGroup In Pure Actionscript3?

Sep 3, 2011

I'm developing a flash app by using free Flex SDK and text editor and compiling in command line.

I want to use VGroup or HGroup in my actionscript to manage positions of DisplayObjects.[code]...

View 1 Replies

ActionScript3 :: Flex : Programmatically Associate A RadioButton With A RadioButtonGroup?

Jul 27, 2009

I have a UI component that, for various reasons, I have to construct programatically. The component is a table of radio buttons grouped by column.Right now, I'm constructing the column groups like so:

private function createGroupsForItemList(items: XMLList): void {
for each (var item: XML in items) {
var rbGroup: RadioButtonGroup = new RadioButtonGroup();
groups[item.@level.toString()] = rbGroup;
}
}

I'm trying to associate the RadioButton instances with the column groups like so:

private function createValueControl(item: XML): UIComponent {
var control: RadioButton = new RadioButton();
control.label = "";

[code]...

I can see in the debugger that the control has an association to the group:

control.group == groups[item.@level.toString()]

However, I can see equally that the group does not know anything about the control:

group.radioButtons.length == 0

I imagine that this is because the setter for group in RadioButton is a dumb setter; all it does is copy to the variable, which doesn't do the magic that groupName does. However, I can't seem to find the value I should use to set the RadioButton.groupName property correctly.So, in short, I'm stumped on how to get these bits to talk to each other. How do I do this?

-- EDIT -- It turns out that I can have the groups created and associated simply by setting the groupName property, but I can't get at the group to set up a selection listener; the group is NULL immediately after the setting process, which means that the second line below throws the Flex equivalent of an NPE:

control.groupName = groupNameForLevel(item);
control.group.addEventListener(Event.SELECT, updateSelection);

View 2 Replies

ActionScript3 :: Flex - Determine The Position Of An XML Instance In An XMLList?

Aug 11, 2009

What it says on the tin: I have an XMLList, and I want to find where in it a particular XML item falls. First index is good enough for my purposes. Note that I have no problem writing a function to do this by hand... but I was hoping that the API has something buried somewhere that'll do it for me. I didn't see it, though.

View 2 Replies

Actionscript3 :: Flex - Declare Generic Class (like Vector)?

Jun 14, 2011

As you all know, Vector support type checking by added Type parameter.

var v:Vector.<String> = new Vector.<String>();

I wonder if I am able to create a custom class that have Type parameter, something like this

var myClassInstance: MyClassDefinition.<String>;

View 1 Replies

Flex :: Crop Image By Selecting Part Of Imageusing ActionScript3.0?

Dec 9, 2009

To crop the image into a selected size by drawing rectangle over it. It should be done in ActionScript 3.0 and Flex 3.0

View 1 Replies

ActionScript3 :: Flex - What Types Of SVG Gradient Fills Are Supported When Using The Embed Meta Tag

Jul 7, 2009

I've been trying to embed some svg files into an AS3 project using the Embed meta tag. For example:

[Code]...

However when displaying these files as Sprites only some of the gradients are surviving the embeding process. From what I've found simple (2 step) horizontal gradients seem to stand the best chance of being preserved, but sometimes other kinds of gradients are as well. In one case simply rotating an object 90 degrees causes the gradient to vanish when displayed in flash. Does anyone know a rough set of rules to use when creating svg gradient fills so they are preserved when rendered in flash? BTW: I used Inkscape to create the images in question.

Update: Bizarrely the solution to this seems to be setting the opacity of any object in the svg file whose gradient isn't displayed properly to a value below 1. Don't ask me why this works but it does. It does however have the unwanted side effect of the objects edges not being rendered as smoothly.

View 4 Replies

ActionScript3 :: Flash CS3 Importing And Using SWC?

Apr 28, 2010

I am trying to create a SWC library for use in my Flash AIR project. I have created a seperate FLA called SceneLibrary and followed the steps defined here:[URL]..to create a new SWC component. I saved the created SWC into a lib folder within my Flash Dev project, I then right click on the SWC item in my project window and choose "Add to Library" This all seems to go fine.

In my code i then go import FirstScene (this is auto completed by Flash Dev) It seems a bit weird to me that the path to this class would simply be

[Code]...

View 1 Replies

ActionScript3 :: Get Real Url Of Page In Which Swf Is Placed?

Nov 27, 2010

So I tried

var url:String = String(this.loaderInfo.url);
var request:URLRequest = new URLRequest(url);
try {

[Code]....

but thay bouth return me to [URL] while I had url [URL] I use flash builder. So what shall I do to recive real full link - not swf link?

View 1 Replies

ActionScript3 :: Arrays - Cannot Convert To C#?

Jun 28, 2011

I am trying to implement sorting function in c# (I wan to sort the array)

card_codes.sort(function() { return 2 * Math.floor(Math.random()) ? -1 : 1 } );

This is how ActionScript sorts array of integers in script and every time after first sort it starts with 301 but When I try to sort same array in c# it always starts with 101. here is how I sort it in c#

Array.Sort(PlayngCardCodes, (f1, f2) => 0.CompareTo(2 * (int)Math.Floor(rng.NextDouble()) == 0 ? -1 : 1));

how to exactly rewrite actionscript sort to get the same result?

View 2 Replies

Flash :: XML Within A TextField In ActionScript3

Jan 23, 2012

I made a simple project which you paste XML into a TextField and and uses this. It works great however it doesn't keep the original structure which wasn't much of a problem until i recently noticed if i load or copy and paste XML which contain comments like:

<min>0.0</min>
<max>255.0</max>

In the TextField it turns to this:

<min>0.0</min>
//
<max>255.0</max>

Which creates problems as from what i can tell it would then run lines of code it should not. I would prefer if it kept the same text structure as the loading/copy and paste method seems to adjust it for some reason.can you keep the exact same XML text structure with working comments? when the XML is in the TextField it removes this part:

<?xml version="1.0" encoding="UTF-8"?>

why does it remove that rather than keeping the text exactly the same? and can i make it keep that or would i have to manually append that text again?

View 1 Replies

ActionScript 3.0 :: Validate Xml File In Actionscript3.0?

Dec 28, 2010

<note>
<to>ahmad</to>
<from>jhon

[code]....

View 2 Replies

ActionScript3 :: Filtering Xml-attributes That Contain Dashes?

Dec 22, 2009

There are dashes in attributes of an xml, and I don't know how to filter them: Here you can see a simple example of the xml:

<posts>
<post>
<photo-url max-width="1280">http://blabla.tumblr.com/photo/98</photo-url>
</post>
</posts>

Because also the photo-url-tag has a dash, I needed to parse it with ...child("photo-url"). This worked fine, but if I want to filter these tags(photo-url), in order to receive all photo-url's with the same attribute: "max-widht='1280'", I couldn't manage to do so. I tried this approach:

var photoUrl:XMLList = xml.posts.post.child("photo-url").(@max-width==1280);

I get this error:

ReferenceError: Error #1065: Variable @max is not defined.

View 2 Replies

ActionScript3 :: Load XML Located Inside .swc?

Mar 11, 2010

I have written a Flex Library project - a .swc file - which is supposed to read default configuration from a XML file inside .swc. This .swc file would be used by other modules to perform some operation. I am unable to make the URLLoader to load the XML inside the .swc file.When i run this as a normal Flex project, things work fine without any issue. With swc, it looks bin-debug folder for the XML and not inside .swc. I want the URLLoader to look inside .swc for the config file. How do i achieve this?

myLoader.load(new URLRequest("config.xml"));
For the above code i get the following error:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL:

[code].....

View 1 Replies

Actionscript3 :: Loading A Swf Named In Xml Into A Parent Swf?

Aug 23, 2010

I have a situation where I use loadvars to load an xml file, which has the address of 2 swf's on the server. I can trace the xml items so know they are loading. So I'm trying to load the swf's but am running into problems. First problem, the swf always gives an error when I publish from flash, "TypeError: Error #2007: Parameter url must be non-null." as it can't find the mention of the xml file, as it's just being published. I'm not sure this affects the next issue which is the swf not loading when I try to load it like this:

var loader:Loader = new Loader();
var defaultSWF:URLRequest = new URLRequest(loadswf1); // where I know loadswf1 = "myswf.swf"
loader.load(defaultSWF);

[code]......

View 1 Replies

Flash :: Adding Scrollbars Using ActionScript3?

Dec 16, 2010

Having some problems adding the default spark.components.VScrollBar scrollbar. All I'm doing is creating a new VScrollBar, setting it's coordinates, a width and height and doing an addChild but it's not showing up. I'm adding other components too that do show up in the same code so that shouldn't not be the problem.What might I be missing?

var a:VScrollBar = new VScrollBar();
a.x = 100;
a.y = 100;[code].....

View 1 Replies

Actionscript3 :: Retrieve IMEI For Android?

Feb 25, 2011

I m developing an app that pulls android device IMEI and matches it against the database Is there a way to retrieve android device IMEI using actions script?

View 1 Replies

Actionscript3 :: Flash - How To Mute Different Sounds

May 24, 2011

i want to have the music always playing and the ability to mute different parts. It is for a project where you click on different people and they come to life to play music. a stop and play would not have them in snyc. I have not been using action script long

var my_sound:Sound = new Sound();
my_sound.load(new URLRequest("triumphant.mp3" ) );
function setMute(vol){
var sTransform:SoundTransform = new SoundTransform(0);

[code]....

View 1 Replies

Actionscript3 :: Identify Device Using Flash?

Jun 21, 2011

How can I get to know that the device is iphone or ipad using actionscript3.0?

View 1 Replies

ActionScript3 :: Stop Sound On ROLL_OUT?

Oct 19, 2011

Im trying to make a simple interactive flash animation so when you roll over a invisible button a sound plays from the library, then when you roll out the sound stops.

So far i have this

import flash.events.Event;
import flash.media.SoundChannel;
stop();

[Code]....

Is there a way to stop the sound playing with ROLL_OUT or stop the current sound when a new one starts?

View 2 Replies

Actionscript3 :: Move The Stage Within A Class?

Dec 18, 2011

how to move the stage within the actual .fla file by modifying this.x and this.y variables in the layer 1 actionscript.

But within the document class- public class Starlight extends MovieClip, it does not seem to work no matter what i try and my research lead me to this use code instead:

for( i = 0; i < stage.numChildren; i ++){
stage.getChildAt(i).x -= player.speedx * player.bounceSpeed;
stage.getChildAt(i).y -= player.speedy * player.bounceSpeed;
}

I do realize that its hacky and slower as compared to actually moving the stage itself. And i'm not sure what's going to happen if another object that moves comes into the stage because technically this code is unnaturally altering the x,y of everything in the stage.

[Code]....

View 1 Replies

ActionScript3 :: Create An XML Music Player?

Dec 20, 2011

I am new to AS3, and I am trying to make an XML music player. For reasons unknown, the music player that I have coded (GUI was made an placed on the stage, so coding for those are not included.) will not display text or play the music. The code I have so far is:

var my_songs:XMLList;
var my_total:Number;
var my_sound:Sound;[code]....

View 1 Replies

ActionScript3 :: Get IndexOf Special Characters In It?

Feb 27, 2012

In ActionScript3 i wanted to get the text between 2 quotes from some HTML using a input index value where i would simply increase the 2nd quote characters value by 1. This would be very simple however i have now noticed using indexOf does not seem to work correctly with quotes and other special characters.[code]...

View 1 Replies

Flash :: DOUBLE_CLICK Dont Work In Actionscript3

Jun 5, 2010

MyMovie.addEventListener(MouseEvent.CLICK, goClick)
function goClick(e:MouseEvent):void
{
trace("Trololo");
}

It's work. Why don't work?

[Code]...

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved