ActionScript 3.0 :: When To Use Primary Expression Keyword (This)

Sep 18, 2009

I'm a complete novice to ActionScript, OOP and Flash. I have no idea when you are supposed to use the keyword "this". I have searched the forums but obviously searching for the word "this" is not very successful! I've read quite a few tutorials now and it seems that different people have different opinions on when and where it should be used. For example what should I be doing in the following class? Both seem to work but is one the "correct" way? Are there situations where things will not work if you omit the "this"?

ActionScript Code:
public class Sector {
private var _radius:Number;
public function Sector(radius:Number){
[B]this.[/B]_radius = radius;
} public function get radius():Number{
return this._radius;
} public function set radius(value:Number):void{
this._radius = value;
}}

I have another possibly related question with regards to naming conventions. I like the use of underscores for properties with getters and setters but what about the names of the constructor parameters that are used to initialise these properties? In the above example I have used "radius" for the constructor parameter although it is also used for the getter and setter functions. It seems a bit of a palaver to come up with different names for the same quantity but is what I have done really bad coding practice?

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Referring To Primary Class' Instance?

Nov 1, 2010

I'm using Flash Develop. Creating a new project creates a Main.as class. How do I refer to the instance of that class from a different file?

View 2 Replies

Photoshop As Primary Editor - Open Images For Editing?

Jun 29, 2009

I have Flash CS4 and whenever I right-click on an image to select "Edit with..." I get that annoying Micro$oft photo editor. Where do I change this so it will open images in Photoshop for editing?

View 4 Replies

Flash Cs4 :: Create Interactive Games For A Primary Classroom?

Sep 20, 2009

Im thinking along the lines of[URL] Im a school teacher who would like to learn to make high quiality games for an interactive whiteboard.

View 1 Replies

ActionScript 3.0 :: Load Alternate SWF Based On Primary SWF's Time?

Jun 29, 2010

I need to load alternate flash content based on the end users bandwidth/ load time of pre-loader. for example:

User 1 enters home page. pre-loader SWF loads in 4 seconds or less, so the high bandwidth SWF is loaded.

User 2 enters home page. Pre-loader SWF loads in more than 4 seconds, so low bandwidth SWF is loaded.

View 2 Replies

Flash :: Use The Asterisk As The Communication Server And Java As Primary Technology In Building The System

Aug 19, 2011

We want to build the web-based softphone using SIP technology And we want to use the Asterisk as the Communication server and Java as primary technology in building the system so we have got following flash based softphone using Adobe Flash,FMG,FMS flex based softphone using Flex , Red5 Server we are also reseraching into MjSIP and PjSIP

[Code]....

View 2 Replies

ActionScript 3.0 :: Goto Keyword In It?

Nov 27, 2009

I'm sitting here doing some C# programing and in one of my switch statements I ended up using the goto keyword. Well just out of curiosity I booted up FDT and created another switch statement in ActionScript 3. Well to my surprise there is apparently no goto keyword in AS3 or at least I couldn't find a substitution.

View 6 Replies

ActionScript 3.0 :: Run Class Without 'new' Keyword?

Jul 31, 2010

I have a class named 'extend', and I want to be able to do something like this:

Code:
var mc = extend(someMovieClip);
instead of:

[code]......

View 1 Replies

Flash :: Specify Fallback Font In Adobe Flex When Some Character Range Is Not Available In Primary Font?

Mar 23, 2011

In my application I'm using a custom embedded font for English (Helvetica New) which does not contain characters (glyphs) for chinese unicode range. In the application, wherver chinese characters are avaiable they are not displayed (suppressed) since they are missing in the custom embedded font. How can I make the flash player to use a fallback system font for the missing characters? And the fallback should be for the missing characters alone. For the Engligh characters it should use the embedded font.

View 1 Replies

ActionScript 2.0 :: Keyword Jump To Frame?

Nov 20, 2009

I'm trying to create a movie, that when a correct word is entered, it goes to a specified frame. The code below words fine but I need to make an addition to it,

on (release, keyPress "<Enter>") {
if (inputtext eq "word1") { gotoAndStop("frame1");
} else if (inputtext eq "word2") {gotoAndStop("frame2");[code]....

I was hoping to add extra words that would go to the same frame. I know I ca do this by�

if (inputtext eq "word1") { gotoAndStop("frame1");
} else if (inputtext eq "word3") {gotoAndStop("frame1");

but was wondering if there is an easier way, something along the lines of�

if (inputtext eq "word1", "word2", "word3") { gotoAndStop("frame1");

View 1 Replies

ActionScript 3.0 :: Search String For A Keyword?

Aug 1, 2009

I was wondering if there is an easy way to search a string for a keyword. I am working on a twitter piece which searches strings for keywords and have found a way of loading all the data properly.

View 1 Replies

ActionScript 2.0 :: Searching For Keyword In Array?

Apr 9, 2010

How can I search for a keyword in an array?

View 3 Replies

ActionScript 2.0 :: Using Array Notation And This Keyword

Feb 19, 2006

I am trying to create a number of movie clips in my main movie but I don't seem to be able to access these movies using array notation and the 'this' keyword. Here's some example code in a main timeline.
var i=0;
createEmptyMovieClip("clip"+1,0);
trace(this["clip"+i]);
////undefined - why?????
var clip=createEmptyMovieClip("clip_holder",1);
clip.createEmptyMovieClip("clip"+i,0);
trace(clip_holder["clip"+i]);
/////_level0.clip_holder.clip0.
This is ok. What's wrong with this["clip"+i] ?

View 1 Replies

ActionScript 3.0 :: Keyword Can Not Be Used In Static Methods

Jan 6, 2011

i got an error in AS.1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.this is the error line.public static var defaultEase:Function = this.easeOut;

View 6 Replies

Media Server :: Connecting FLME With DVRCast - Get An Error "Failure To Connect To Primary Server?

Jun 22, 2011

I am trying to set up DVR streaming using FLME. I'm following this tutorial: http:[url]........I'm up to Step 2,

I put in the following information into the FLME:
FMS URL: rtmp://222.222.222.222/dvrcast_origin
Stream: mp4:sample.f4v

Then click 'Connect' , but I get an error "Failure to connect to primary server verify that your server URL and application name are valid and that your internet connection is working and retry". My server is a 32-bit windows 2007 VPS , with FMS running.I don't know if I set up the DVR Cast application correct. All I did was copy the dvrcast_origin into the installationdirectory/applications, then I started a new instance of dvrcast_origin with _definst_...Also, I am running the trial version of FMS, and DVR needs FMIS. Is there a way I can just run FMIS?

View 16 Replies

Flash :: Make Video Primary And HTML5 Video Secondary?

Apr 4, 2011

I need to make a video page. i used a flash player and implemented the videos on the pages. now my client needs that, the same page have to work with ipads, i know that we have to use html5 video player for that.

My question is in case eventhough html5 video supportable player available that should play the flash content first. in case it will not run the flash player then it should run the html5.

View 2 Replies

ActionScript 2.0 :: Enter Keyword And Search On YouTube

Aug 1, 2010

I am trying to do the search api for my flash site. I need to know how to enter the keyword and search on youtube. Then youtube will return the videos list which the user can click and watch it.

View 1 Replies

Flex :: What Is The Keyword That Allow To Implement An Abstract Class

Nov 25, 2010

what is the keyword that allow me to implement an abstract class? It was asked in my interview..Can you say it from both java and ActionScript(flex)

View 2 Replies

ActionScript 3.0 :: Make Keyword Search Window ?

Nov 10, 2009

I am again in trouble with my new project where i have to make a keyword search popup.There is a online study material from which i have to search keywords.Study materials are coming from XML file.So I placed a button for search option.when I'll press it there should be a popup window with keyword search fields ( as shown in image in attachment ).What I could do is, I can popup the window with given fields bt i dont know how to search for given keywords.

View 3 Replies

ActionScript 2.0 :: Build Up The Search Function That Contains 400 More Keyword?

Nov 18, 2009

i have a big problem with Search function to build the Glossary.. First, what is the best way to build up the Search function that contains 400 more keyword?? what way should i use, with XML, or combo box or etc????

I have used the text field with String.indexOf() .. but it seem like not the best way.. because it's really long..

View 1 Replies

ActionScript 2.0 :: Linking A Button To Keyword Within A .jpg File

Apr 14, 2006

I was ust wondering how I would go about linking a button to a keyword within a .jpg file, within a folder and making that .jpg appear within a window. The word that the button will search for will not be the full name of the .jpg, it will only be part of the .jpg file name.

View 1 Replies

ActionScript 2.0 :: 'this' Keyword Not Working Inside OnLoadInit

Oct 21, 2006

I'm tyring to do some OOP coding but have trouble figuring out how to keep it all nice and clean. Observe the following class I've made:

Code:
class Link {
public var identifier:Number;
var xpos:Number;

[Code]....

The problem is that I can't access my class properties inside the onLoadInit event function. What is the good OOP way to access these properties?

View 9 Replies

ActionScript 3.0 :: Expected Definition Keyword After Attribute Function

Apr 23, 2009

I have been building my website using a simple mouse event click system that makes movie clips play at specifically names keyframes. it took me a bit, but I got it right and the code was simple. here is an example of the code that works:
films.addEventListener(MouseEvent.ROLL_OVER, btnOver1);
function btnOver1(event:MouseEvent):void{
sketch_5.gotoAndPlay("f_over");
}

Pretty simple stuff. but now I am working on a paid project for someone, and it is a bit more complicated in scope, but essentially I would be using the same code over and over again. it's a glorified slide show. but I ran into a problem. I used this code, which is the same (with different names and mouse event) as the one above.
mcLifeLED.addEventListener(MouseEvent.CLICK, Light_Type);
Function Light_Type(event.MouseEvent):void{
mlights.gotoAndPlay("p_life");
}

Its telling me that "Function Light_Type(event.MouseEvent):void" is wrong with this message "1071: Syntax error: expected a definition keyword (such as function) after attribute Function, not Light_Type." I may be wrong, but from what I can read in it, it's telling me that the function I named about "Light_Type" can't be found...

View 2 Replies

ActionScript 3.0 :: Scan Textfield For Keyword And Apply Formatting

Jul 14, 2011

I was interested in searching through text in a textfield, and applying text formatting to keywords. For example, every time the word 'the' appears, apply a text format that changes it to green and 14pt. Here is an example of a format and text applied to a textfield. How would I go about searching through the textfield and applying this format only to specific words? my_txt.text = 'The cat jumped over the house.'

/// my format I want to apply
with (_lt_fmt) {
align = 'left';
blockIndent = 0;

[Code]....

View 8 Replies

Actionscript :: Google Keyword Tool - Get Data From Flex

Apr 11, 2011

I am a flex developer, well this time , client requirement has came to search the keyword in google adword, go to the following link, if i enter some keyword here in the search box like [URL] "dog training tips", so i get lots of results, i have to develop this same application in flex, which will fetch the data from this google's tool, Does any one of about how to get this data from flex, is there any flex or actionscript API available which will return me the data, that i'll filter according to ma requirement,

View 1 Replies

ActionScript 3 :: Why Omit New Keyword When Instantiating Custom EventDispatcher

Aug 16, 2011

I am currently reading the Actionscript 3 Bible and the author shows an example in which a custom eventDispatcher class is created. When the class is later used in the code it's called as such:

//Thermometer is a custom eventDispatcher that extends the eventDispatcher class.
var thermometer:Thermometer = Thermometer(event.target); //why no new keyword?

I'm a new programmer and I was curious if someone could explain how this works? Why is the new keyword omitted? When you omit the new keyword on a class that extends another class is it essentially just calling the superclass(eventDispatcher) constructor?

View 1 Replies

ActionScript 3.0 :: Using The 'new' Keyword To Create New Instances Of Loaded Content?

Aug 6, 2009

I've been testing what you can do with loaded content lately and I'm trying to use the 'new' keyword to create new instances of a loaded swf. For example...

ActionScript Code:
function onLoadComplete(e:Event):void{
var loadedSwf:MovieClip = e.currentTarget.content;

[code]....

View 4 Replies

Actionscript 3 :: Using Return Keyword In A Function That Returns Void?

Jun 28, 2011

Today I've received a small ActionScript 3 application that I need to have a look at and make some changes to.I've noticed that the entire application is riddled with the return keyword, eg:

// Constructor
public function MyClass()
{
// some logic[code].....

Is there a possible reason for this, or is the developer who worked on this using some weird, self-taught practice?

View 1 Replies

ActionScript 3.0 :: 1071: Syntax Error: Expected A Definition Keyword

Nov 7, 2011

I am trying to link a button to a URL, however I keep getting the error

1071: Syntax error: expected a definition keyword (such as function) after attribute Function, not webfunction.

ActionScript Code:
import flash.events.MouseEvent;
import flash.net.URLRequest;
webdes_btn.addEventListener(MouseEvent.CLICK,webfunction);

[Code].....

PS it's not really "Website" (Obviously) however I can't post links until i have at least a 50 post count.

View 1 Replies

ActionScript 3.0 :: Method In A Class File That Refers To Itself - The This Keyword Is Not Working?

Sep 27, 2011

Code:

package
{
import flash.display.MovieClip;
import flash.display.Graphics;
public class Rail extends MovieClip

[code]...

this is a simple Rail class, what I am trying to do is take the for loop out of the timeline and build into the Rail class itself. How do I refer to the Rail class itself within the method? If I am doing this the wrong way please let me know! Would it be better if I created another class, say a "RailSpacing" class and build the for loop into the contructor into that?

Also, if I wanted to add depth to the rail(textures or something else to make it look real) and still be able to change the color without transforming the entire rail instance, what could I do ActionScript wise. I have come to the conclusion the only way to do this is creating a multilayered movieclip and target the base object and not the highlight/ shading layer.

Also, if I created a nice graphic/movieclip and exported it for ActioSncript, how can I find the class file and add too it? Is this even possible? Is it possible to draw something that is detailed and export it and then add some methods?

View 1 Replies







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