ActionScript 3.0 :: The Keyword "this" Doesn't Change Scope?

Jan 29, 2009

-I have an object with a function:

var AppMethod : Object = {
testFunction : function() { trace(this) }
}

-In the constructor of a separate class named "Vec", I call testFunction in the AppMethod object by:

NameSpace.AppMethod['testFunction']();

-After I create an instance of Vec, flash traces the AppMethod object. I thought it would trace the Vec object? At least that how it worked in javascript. The keyword "this" doesn't change scope in Actionscript 3? Is there a keyword that will trace the Vec object instead of the AppMethod object?

View 9 Replies


Similar Posts:


Flex :: Object Doesn't Look Up Scope Tree For Variables?

Aug 4, 2009

I have a simple object defined by an object literal, and have a couple functions assigned to this object. Inside the functions, I try to access global variables, and it only gets undefined. The Flex debugger tells me the variables are just right up the scope tree.Yes, I know I can access Thing by using 'this', that doesn't solve my scope issue though.Project Flex Compiler Settings: Flex SDK 3.4, Require Flash Player 10.x.Example:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="Thing.bling();">
<mx:Script>
<![CDATA[

[code].....

View 2 Replies

ActionScript 2.0 :: Scope - _root In Gallery.swf Doesn't Work Within Index.swf?

Oct 27, 2006

This is a situation: i have a index.swf in which i have holder movieclip in which i load gallery.swf (where i load pictures in it's holder mc). The thing is i used _root in gallery.swf so when i publish it separately it works, but it doesn't work within index.swf. I suppose there is a scope problem where _root adresses _root timeline of index.swf instead of gallery.swf when index.swf is published and gallery.swf loaded inside. I tried to solve this by putting: Code: this._lockroot=true; inside of gallery.swf but now my Flash 8 player just freezes when index.swf is published and gallery.swf loaded into it but i have no idea why? What would be other solution for this problem?

View 3 Replies

ActionScript 2.0 :: Loadvar And Scope Variable - Array Seems Set To Null Or Out Of Scope

Jul 1, 2004

I add this actionscript code on the first frame. Variables are loaded but. The question is below the code.

[Code]...

View 2 Replies

ActionScript 3.0 :: Top-level Scope From Static Scope Conundrum

Apr 2, 2010

I have a Debug class I've written, and I'd like to include a static trace() method in there, unfortunately I have no idea how to then access global / top level trace as effectively I've blocked it with the local static scope.[code]

View 4 Replies

AS3 :: Change X Value Of A Parent Doesn't Apply X-change To Its Children?

Dec 12, 2010

So basically I have a class which adds items and needs a drag and drop. I change the x value of the entire contianer class simply by this.x = something

By drag and drop all the items slide across the screen. When I trace the x value of the container class it has changed, but the x value of the items stayed the same (although their x value on the screen definitely changed).

View 1 Replies

Actionscript 3.0 :: Variable Doesn't Change Right?

Jan 7, 2010

in Document Class action script file I have the following variable

Code: Select allvar ballPointRight = new BallPointRight(ball,xDir,padScreen);

And then in BallPointRight action script file which is linked with BallPointRight movie clip I have the following code

Code: Select allpackage {
import flash.display.MovieClip;[code]...

So the line xDir = -1; doesn't change variable located in Document Class action script file even if if sentence is true... Is it maybe because it's number?

View 3 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

ActionScript 2.0 :: Doesn't Seem To Change Text Of Button

Apr 2, 2010

I made a new symbol. The symbol name is button. And it's text is "Start Generator" - So this code:[code]Doesn't seem to change the text of the button to "You clicked it"

View 4 Replies

Flash 9 :: Why Doesn't The Registration Point Change

Jan 31, 2006

I have a symbol created out of a bitmap image. When I converted the "bitmap" to a "movieclip" object, I selected the center registration point in the dialog box. After the symbol is created an placed on the stage, I can seen the registration point at the center of the movieclip. Nevertheless, if I check the coordinates of the movieclip, it refers to the top left corner instead of the registration point. The most strange thing is that if I try to check the coordinates of the movieclip using Actionscript - something like trace("x: " + mc._x + "y: " + mc._y); - it do refers to the center point of the movieclip. So how can I have the coordinates during design time the same as during runtime? Why do I always have to refer to the top left corner and not to the ACTUAL registration point?

View 9 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 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

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

ActionScript 3.0 :: Change This Script So It Doesn't Load Into A New Window?

Jan 25, 2010

I have this script on an invisible button on a banner ad, but the client doesn't want the linked page to open in a new window, but rather load over the page in same window. How can I change the script to accomplish this,

link_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.sdesignsstore.com/store.html"));

[code]........

View 3 Replies

Flex :: Renderer Grid - Doesn't Change Dataprovider

Aug 8, 2011

Is there a way to apply a renderer to a grid in a way so that it doesn't modify the values in the data provider? I have a datagrid and on one of its columns I have a customer renderer which overrides the set data function and converts the number value in the dataprovider to a word. My problem is that when I sort the grid by that column it sorts by the new value, whereas I want it to sort by the old value that was originally in the dataprovider. Here is my renderer:

[Code]...

View 2 Replies

ActionScript 3.0 :: Masking Doesn't Change When The Mask Movieclip Changes?

Sep 13, 2009

I have a movieclip Planet which consists out of a backround (BG) and a mask (PMask). The mask will be changed during gameplay (I add shapes, then draw this to a bitmap and replace the shapes with the bitmap).But for some reason the mask doesnt change along with the mask movieclip(as if it makes a copie of PMask and uses that as the mask instead, so that every change to PMask isnt applied to the mask of BG)This is basically my Planet.as file (I removed the stuff that isn't related):

Code:
package
{
import flash.display.MovieClip;[code]....

I don't know why I would need the "cacheAsBitmap", but it doesn't seem to mask at all when I don't use it.

View 0 Replies

Actionscript 2.0 :: Adding Variables - Doesn't Change Frames

Feb 3, 2010

I'm having trouble with a script I'm writing and don't understand why. I have

[Code]....

on a a button that I have, but when i test my file and click on the button, it doesn't change frames.

View 4 Replies

ActionScript 2.0 :: For In Loop Isn't Working - Doesn't Change The Alpha Of Anything

Apr 15, 2008

I have a class file that contains a for in loop. basically there are 50 states (movieclips) on the stage and here is what I have:

[Code]...

I don't think I understand enough about arrays or for in loops to understand why this isn't working... it traces the array, but not statesArray[states], and it doesn't change the alpha of anything.

View 1 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 2.0 :: Movieclip OnRelease - Cursor Doesn't Even Change Into A Hand

Nov 5, 2005

I have a movieclip and I load a png file into it. then I want to put an onRelease on it and this won't work.. my cursor doesn't even change into a hand... Am I missing somthing here?

[Code]...

View 3 Replies

ActionScript 3.0 :: RadioButtonsGroup Change Event On The Stage - Doesn't Respond

Oct 8, 2009

The situation: - some radio buttons on the stage (design time, flash GUI) - A quiz class What I want: - create a RadioButtonsGroup in the quiz class (not with the flash GUI) - assign all the radios to that group (radio.group = myGroup) - respond to the CHANGE event It seems not to work. The group gets created (all the radios of that group are indipendent from the others on the stage), but it doesn't respond to the event.

View 1 Replies







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