1180: Call to a possibly undefined method... Possibly?
I have buttons, that when clicked will create an instance in one of 3 movie clips within a movie clip.
For instance, this works just fine:
b_IF_4G5_TOP.addEventListener(MouseEvent.CLICK, b_IF_4G5_TOP_add);
function b_IF_4G5_TOP_add(event:MouseEvent):void
var b:MovieClip = new IF_4G5_TOP();
b.name = "IF_4G5_TOP";
layout.substrate.addChild(b);
but this does not:
p_conn_h.addEventListener(MouseEvent.CLICK, p_conn_h_add);
function p_conn_h_add(event:MouseEvent):void
var b:MovieClip = new PC_H(); <- This line produces this error: 1180: Call to a possibly undefined method PC_H.
b.name = "p_conn";
layout.connectors.addChild(b);
Which is odd, because as you can see in the first example, I have not "defined" var b:MovieClip = new IF_4G5_TOP();
Both objects exist in the library, are movie clips, both targets and objects are accuratley named and exist.
Am I missing something obvious? Thanks in advance for your help.
Thanks for the suggestions, guys.
I did try renaming the movieclips, no success.
The movieclips that work fine, like IF_4G5_TOP have no as linkage or anything. The code simply places a copy of the movieclip from the library onto the stage within its target movieclip.
I even tried to change their target to the same target as the ones that work:
layout.connectors.addChild(b);
to
layout.substrate.addChild(b);
But no go...
Why do you suppose an identical function would work in one case, but throw errors in another? It's seemingly irrational inconsistencies like this that are so frustrating about actionscript.
Any ideas? Thanks again.
Similar Messages
-
1180: Call to a possibly undefined method getDefinitionByName
1180: Call to a possibly undefined method getDefinitionByName. << i have this error
i want to draw coins.
so in library i have playerCoins100 and playerCoins200 movie clips with classes like name and base class: flash.display.MovieClip
separated code:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//show points in user bag
var classNames:Array = ["playerCoins100", "playerCoins200"];
var boxesList:Array = [];
var ClassRef:Class;
for (var i:int = 0; i < classNames.length ; i++)
ClassRef = Class(getDefinitionByName(classNames[i]));
boxesList[i] = new ClassRef();
addChild(boxesList[i]);
var currentBox:MovieClip;
var numCol:int = 3;
for (var columnIterator:int = 0; columnIterator < boxesList.length; columnIterator++)
var column:int = columnIterator % numCol;
var row:int = int(columnIterator / numCol);
currentBox = boxesList[columnIterator];
currentBox.x = currentBox.width * column;
currentBox.y = currentBox.height * row;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
any ideas?how i can put this array to point with coordinate x=200 and y=300 ?
need create mc and put elements to this mc? or how? -
1180: Call to a possibly undefined method BlueSquare.
I keep get error mesage of what say 1180: call to possibly undefined method bluesquare what my object in the library
some one please help.
Here the tutorial i'm try do to learrn flash.
here action script 3.0 code
var myBlueSquare = new BlueSquare();
trace(myBlueSquae);my class is this bluesquare in lower case letter no upper.
-
Error 1180: Call to a possibly undefined method class_name
hi,
i am new AS 3.0. When i try to compile my file it show the following error.
1180: Call to a possibly undefined method ClassA. var obj =new ClassA(10,10);
My class file contains...
class ClassA {
public var Avg:Number = 0;
public function ClassA(a, b) {
Addit(a,b);
public function Addit(aval:Number, bval:Number):Number {
Avg = aval+bval;
trace("Average - "+Avg);
return Avg;
i have called in flash file....
import ClassA;
var obj =new ClassA(10,10);
Any help Pls....
Ayathasi have modified my AS file as
package TestPackage{
import flash.display.Sprite;
public class ClassA extends Sprite {
public var Avg:Number = 0;
public function ClassA(a, b) {
Addit(a,b);
public function Addit(aval:Number, bval:Number):Number {
Avg = aval+bval;
trace("Average - "+Avg);
return Avg;
i have included the document path in the properties panel as, TestPackage.ClassA
now it show's following error message....
ArgumentError: Error #1063: Argument count mismatch on AS::ClassA$iinit(). Expected 2, got 0.
When i modifiy ClassA construnctor as follows, it works fine.
public function ClassA() {
var a = 10;
var b = 10;
Addit(a,b);
how can i get input values from the user..........
Thanks in Advance,
Ayathas
Message was edited by: ayathas -
1180: Call to a possibly undefined method error for DEFINED method
Hi,
I have Document Class main.Core that in package main
In the first frame of the .fla I have:
stop();
startGame();
public function startGame():void {
world = new World();
world.startWorld();
World is class in package world.
I use import world.World;
When I am tryng to export I get the error:
1180: Call to a possibly undefined method startWorld.
Can someone tell me why?
Thanks.what's the following show:
package world {
import flash.display.MovieClip;
public class World extends MovieClip {
public function World():void {
trace(this);
public function startWorld():void {
trace("b"); -
ActionScript 3 Noob Help - 1180: Call to a possibly undefined method addChild.
Hey everyone, i'm in the process of learning ActionScript 3. I'm woking on my first OOP game with a class other than the document class.
Right now, my game has a preloader library symbol called PreLoader and one called MainMenu (they have been exported for actionscript). All other objects are subobjects of these Movie Clips. My code si split into three actionscript files called Main.as (the document class. I had planned this to load and unload the preloader, mainmenu, and game itself) MainMenu.as (meant to controll the main menu's buttons and listeners) and PreLoader.as (which has the pre-Loader code in it.) I was having a lot of trouble with unloading the main menu and preloader after I was finished with them, so I let the document class handle them, which led to a series of errors as follows:
C:\Users\...\hamletgame\Main.as, Line 19 1120: Access of undefined property mainMenu.
C:\Users\...\hamletgame\Main.as, Line 20 1180: Call to a possibly undefined method addChild.
C:\Users\...\hamletgame\Main.as, Line 20 1120: Access of undefined property mainMenu.
C:\Users\...\hamletgame\Main.as, Line 21 1180: Call to a possibly undefined method removeChild.
C:\Users\...\hamletgame\Main.as, Line 21 1120: Access of undefined property preLoader.
C:\Users\...\hamletgame\Main.as, Line 25 1180: Call to a possibly undefined method removeChild.
C:\Users\...\hamletgame\Main.as, Line 25 1120: Access of undefined property mainMenu.
Thank you all very much in advance. I'm sure its something simple i've missed. My code is posted below.
Main.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class Main extends MovieClip
var preLoader:PreLoader;
var mainMenu:MainMenu;
public function Main()
preLoader = new PreLoader;
addChild(preLoader);
static public function loadMainMenu():void
mainMenu = new MainMenu();
addChild(mainMenu);
removeChild(preLoader);
static public function loadGame():void
removeChild(mainMenu);
PreLoader.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class PreLoader extends MovieClip
//Declare Variables Here
//Constructor Function
public function PreLoader()
gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, loading);
//Functions
private function loading (event:Event):void
var total:Number = stage.loaderInfo.bytesTotal;
var loaded:Number = stage.loaderInfo.bytesLoaded;
loadingBar.scaleX = loaded/total;
if(loaded==total)
gotoAndStop(2);
removeEventListener(Event.ENTER_FRAME, loading);
playButton.addEventListener(MouseEvent.CLICK, startMovie)
private function startMovie (event:MouseEvent):void
removeEventListener(MouseEvent.CLICK, startMovie);
Main.loadMainMenu();
MainMenu.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class MainMenu extends MovieClip
//Constructor Function
public function MainMenu()
addEventListener(Event.ENTER_FRAME, onFrameEnter);
//Other Functions
private function onFrameEnter(event:Event):void
if(currentFrame==30)
stop();
playGameButton.addEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.addEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.addEventListener(MouseEvent.CLICK, onCreditsButtonClick);
removeEventListener(Event.ENTER_FRAME, onFrameEnter);
else
removeEventListener(Event.ENTER_FRAME, onFrameEnter);
private function onPlayGameButtonClick(event:MouseEvent):void
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
Main.loadGame();
private function onInstructionsButtonClick(event:MouseEvent):void
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
private function onCreditsButtonClick(event:MouseEvent):void
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);I'm not sure why I'm not able to use all 3 of your classes as intended. I read that you cannot access the Document Class from other classes directly. So This is what I have:
Main.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class Main extends MovieClip
var preLoader:PreLoader;
var mainMenu:MainMenu;
public function Main()
preLoader = new PreLoader;
addChild(preLoader);
trace("Main");
public function loadGame():void
trace("loadGame start");
//removeChild(mainMenu);
trace("loadGame finish");
MainMenu.as
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class MainMenu extends MovieClip
//Constructor Function
var playGameButton:PlayGameButton;
var instructionsButton:InstructionsButton;
var creditsButton:CreditsButton;
var main:Main;
var mainMenu:MainMenu;
var preLoader:PreLoader;
var container1_mc:MovieClip;
public function MainMenu()
trace("MainMenu");
PreLoader.as (this is where the heart of your app is)
package
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.Loader;
import flash.display.LoaderInfo;
public class PreLoader extends MovieClip
//Declare Variables Here
var playGameButton:PlayGameButton;
var instructionsButton:InstructionsButton;
var creditsButton:CreditsButton;
var main:Main;
var mainMenu:MainMenu;
var preLoader:PreLoader;
var loadingBar:LoadingBar;
var playsButton;
var container_mc:MovieClip;
//Constructor Function
public function PreLoader()
gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, loading);
//Functions
public function loading (event:Event):void
var total:Number = stage.loaderInfo.bytesTotal;
var loaded:Number = stage.loaderInfo.bytesLoaded;
loadingBar=new LoadingBar();
addChild(loadingBar);
loadingBar.x=50;
loadingBar.y=50;
var playsButton=new PlaysButton();
loadingBar.scaleX = loaded/total;
if(loaded==total)
removeChild(loadingBar);
//stop();
trace("loaded equals total");
gotoAndStop(2);
removeEventListener(Event.ENTER_FRAME, loading);
addChild(playsButton);
playsButton.x=50;
playsButton.y=250;
playsButton.addEventListener(MouseEvent.CLICK, startMovie);
public function startMovie(event:MouseEvent):void
//removeEventListener(MouseEvent.CLICK, startMovie);
trace("startMovie");
loadMainMenu();
public function loadMainMenu():void
var main:Main;
var mainMenu:MainMenu;
var preLoader:PreLoader;
var container1_mc:MovieClip;
trace(currentFrame+"cf");
trace("loadMainMenu start");
container1_mc= new MovieClip();
addChild(container1_mc);
playGameButton=new PlayGameButton();
trace("1");
instructionsButton= new InstructionsButton();
creditsButton = new CreditsButton();
playGameButton.x=100;
playGameButton.y=100;
instructionsButton.x=200;
instructionsButton.y=100;
creditsButton.x=300;
creditsButton.y=100;
trace(creditsButton.name);
trace(creditsButton.x);
trace(creditsButton.y);
trace(container1_mc.x);
trace(container1_mc.y);
addChild(playGameButton);
playGameButton.name="playGameButton";
instructionsButton.name="instructionsButton";
creditsButton.name="creditsButton";
trace(creditsButton.name);
trace("2");
addChild(instructionsButton);
addChild(creditsButton);
trace("loadMainMenu finish");
MainMenus();
public function MainMenus():void
addEventListener(Event.ENTER_FRAME, onFrameEnter);
trace("MainMenus");
//loadMainMenu();
public function onFrameEnter(event:Event):void
trace("AA");
if(currentFrame==0)
if(creditsButton.name=="creditsButton"){
stop();
trace("frame 30");
trace(currentFrame);
trace(creditsButton.name);
playGameButton.addEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.addEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.addEventListener(MouseEvent.CLICK, onCreditsButtonClick);
removeEventListener(Event.ENTER_FRAME, onFrameEnter);
else
removeEventListener(Event.ENTER_FRAME, onFrameEnter);
public function onPlayGameButtonClick(event:MouseEvent):void
trace("A");
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
//main.loadGame();
public function onInstructionsButtonClick(event:MouseEvent):void
trace("B");
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
public function onCreditsButtonClick(event:MouseEvent):void
trace("C");
playGameButton.removeEventListener(MouseEvent.CLICK, onPlayGameButtonClick);
instructionsButton.removeEventListener(MouseEvent.CLICK, onInstructionsButtonClick);
creditsButton.removeEventListener(MouseEvent.CLICK, onCreditsButtonClick);
I've exported each button and movie clip which resides on the stage in the Library. I've removed them from the stage/Timeline and just have the Exports in ActionScript on Frame 1. I also noticed I couldn't access frame 30 and had to change the code to "if(currentFrame==0)....."
I hope this gets you started in the right direction though I'm not sure what I've done is what you're looking for. -
Image + 1180 error + possibly undefined method
Below is a piece of code I've written and getting an "1180: Call to possibly undefined method test".
<mx:Script>
<![CDATA[
public function testDC(): void {
Alert.show("Testing");
]]>
</mx:Script>
<mx:Panel id='Test' title = 'Test' width = '100%' height = '100%' creationPolicy="all" backgroundColor="white" backgroundAlpha=".01">
<mx:VBox label = 'Topology View' showEffect = '{wipe_left}' width='100%' height='100%'
cornerRadius="5" paddingBottom="15" paddingLeft="5" paddingRight="5" paddingTop="15" clipContent="true">
<adobe:SpringGraph id="springgraph" width="100%" height="95%" bottom="0" top="40"
right="0" left="0" clipContent="true">
<adobe:itemRenderer>
<mx:Component>
<mx:Image width="24" height="24"
source="{(data.id==null)?'': (data.id.search('\\.') > 0) ? 'assets/icons/teacher.png' : 'assets/icons/student.png'}"
toolTip="{data.data}" doubleClickEnabled="true" doubleClick="testDC()"/>
</mx:Component>
</adobe:itemRenderer>
</adobe:SpringGraph>
</mx:VBox>
</mx:Panel>
If I do not call the method, I don't get the error, but I need to perform some operations on the clicking the image.
1. I've also tried to use icon, but with no success.
2. I've tried to remove the <adobe:itemRenderer> and the <mx:Component> tags, in this case the images don't get loaded and the screen looks bad.
Any help?I put the script tag within the image tag and it worked.
-
Call to possible undefined method
This is the code I have
I have a actionScript class called Test.
import com.xxxx.com.Test;
var testData : com.xxxx.com.Test = new Test();
testData.setBookName("Java 5");
I get the following errors
1046: Type was not found or was not a compile-time constant:
1180: Call to a possibly undefined method.This:
testData.setBookName("Java 5");
MUST be done inside a function and not in the declaration
section. The variable does not exist yet. Create an init function()
and call that from the initialize or creationComplete events. Do
the assignment in that function.
Tracy -
Call to a possibly undefined method setPropertyIsEnumerable?
Hi,
I am trying to accomplish using doubleClick events on dateChoosers. Below is the code that is working:
<mx:VBox>
<mx:Label text="Simple DateChooser control."/>
<mx:DateChooser id="dateChooser1" doubleClickEnabled="true"
doubleClick="displayDate2()"
change="displayDate(DateChooser(event.target).selectedDate)"/>
<mx:Label id="selection" color="blue" text="Date selected:"/>
</mx:VBox>
I tried putting in doubleClickEnabled as true in Actionscript, and then call the event, and this is the syntax I used:
//enable the double Click Enabled Property
dch.setPropertyIsEnumerable("doubleClickEnabled",true);
dch.addEventListener("doubleClick", useDate2);
This did not work, and I got this error instead: 1061: Call to a possibly undefined method setPropertyIsEnumerable through a reference with static type mx.controls:DateChooser.
I tried to find a suitable import statement to insert in my code, but I am not sure what to put there. Could anyone please give me a hint what to do here to get my code to accept the method?
Thanks in advance.
AliceHi, Ryan:
Thanks, I got that to work, but it seems like the doubleClick does not allow me to use it on the dateChooser. Here is the code:
The MXML:
<mx:VBox id="box2">
<mx:DateChooser id="dch" doubleClickEnabled="true"
doubleClick="displayDate2()"
change="displayDate(DateChooser(event.target).selectedDate)"/>
</mx:VBox>
The same thing in Actionscript, but not working:
dch = new DateChooser();
dch.addEventListener("change", displayDate);
dch.doubleClickEnabled = true;
dch.addEventListener("doubleClick",displayDate2);
//Got an error saying TypeError: Error #1034: Type Coercion failed: cannot convert flash.events::MouseEvent@20112769 to
//mx.events.CalendarLayoutChangeEvent.
box2.addChild(dch);
Could you give me some pointers on what I have wrong here?
Thanks for your help.
Alice -
Hi Guys,
As i am using the nigtly build of TLF 4.0.0.11073.
I want to copy some text from the TLF, by copy operation. I am getting this type of Error.
- Call to a possibly undefined method getClipboardContents through a reference with static type flashx.textLayout.edit:ISelectionManager.
In the previous build, i dont use to get this type of error, but in this nightly builds i am getting this type of error.
Can anyone help me to fix the same or any workaound.
Thanks in advance.
KrishnaThis functionality is still available, but it has moved. It's now in a TextClipboard class, in the same flashx.textLayout.edit package. So you should replace calls to getClipboardFormat() with TextClipboard.getContents().
Hope this helps,
- robin -
Call to a possibly undefined method
I am having a real problem with using two different Tile Lists in one movieClip I keep getting:
call to a possibly undefined method trousers1
call to a possibly undefined method trousers2
call to a possibly undefined method trousers3
call to a possibly undefined method trousers4
call to a possibly undefined method trousers5
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
import fl.controls.Slider;
import fl.events.SliderEvent;
import fl.controls.Label;
import fl.controls.NumericStepper;
import flash.events.Event;
import fl.controls.TileList;
import flash.display.DisplayObject;
import fl.events.ListEvent;
import flash.utils.getDefinitionByName;
import flash.events.EventDispatcher;
import fl.controls.SelectableList;
public class Main extends MovieClip
//Variables
var startPage:StartPage;
var tutorialPage:TutorialPage;
var maleSizePage:MaleSizePage;
var femaleSizePage:FemaleSizePage;
var maleDragDropPage:MaleDragDropPage;
var femaleDragDropPage:FemaleDragDropPage;
var objTShirt:Object={};
var objTrouser:Object={};
//clothes variables
var tshirt1:tShirt1;
var tshirt2:tShirt2;
var tshirt3:tShirt3;
var tshirt4:tShirt4;
var trousers1:Trousers1;
var trousers2:Trousers2;
var trousers3:Trousers3;
var trousers4:Trousers4;
var trousers5:Trousers5;
var _isDragging:Boolean;
public function Main()
//Pages
startPage = new StartPage;
tutorialPage = new TutorialPage;
maleSizePage = new MaleSizePage;
femaleSizePage = new FemaleSizePage;
maleDragDropPage = new MaleDragDropPage;
femaleDragDropPage = new FemaleDragDropPage;
objTShirt[0+"_"+0] = new tShirt1;
objTShirt[1+"_"+0] = new tShirt2;
objTShirt[2+"_"+0] = new tShirt3;
objTShirt[3+"_"+0] = new tShirt4;
objTrouser[0+"_"+0] = new trousers1;
objTrouser[1+"_"+0] = new trousers2;
objTrouser[2+"_"+0] = new trousers3;
objTrouser[3+"_"+0] = new trousers4;
objTrouser[4+"_"+0] = new trousers5;
_isDragging = false;
addChild(startPage);
//Event Listeners Buttons
startPage.startButton.addEventListener(MouseEvent.CLICK,startButtonClick);
tutorialPage.continueButton.addEventListener(MouseEvent.CLICK,tutorialContinueButtonClick);
maleSizePage.continueButton.addEventListener(MouseEvent.CLICK,maleSizeContinueButtonClick);
femaleSizePage.continueButton.addEventListener(MouseEvent.CLICK,femaleSizeContinueButtonClick);
//Size Page Event Listeners
maleSizePage.heightSlider.addEventListener(SliderEvent.CHANGE,heightSlChange_M);
maleSizePage.neckSlider.addEventListener(SliderEvent.CHANGE,neckSlChange_M);
maleSizePage.chestSlider.addEventListener(SliderEvent.CHANGE,chestSlChange_M);
maleSizePage.waistSlider.addEventListener(SliderEvent.CHANGE,waistSlChange_M);
maleSizePage.armSlider.addEventListener(SliderEvent.CHANGE,armSlChange_M);
maleSizePage.legSlider.addEventListener(SliderEvent.CHANGE,legSlChange_M);
maleSizePage.heightValue.addEventListener(Event.CHANGE,heightVChange_M);
maleSizePage.neckValue.addEventListener(Event.CHANGE,neckVChange_M);
maleSizePage.chestValue.addEventListener(Event.CHANGE,chestVChange_M);
maleSizePage.waistValue.addEventListener(Event.CHANGE,waistVChange_M);
maleSizePage.armValue.addEventListener(Event.CHANGE,armVChange_M);
maleSizePage.legValue.addEventListener(Event.CHANGE,legVChange_M);
femaleSizePage.heightSlider.addEventListener(SliderEvent.CHANGE,heightSlChange_F);
femaleSizePage.bustSlider.addEventListener(SliderEvent.CHANGE,bustSlChange_F);
femaleSizePage.hipSlider.addEventListener(SliderEvent.CHANGE,hipSlChange_F);
femaleSizePage.armSlider.addEventListener(SliderEvent.CHANGE,armSlChange_F);
femaleSizePage.waistSlider.addEventListener(SliderEvent.CHANGE,waistSlChange_F);
femaleSizePage.legSlider.addEventListener(SliderEvent.CHANGE,legSlChange_F);
//Drag and Drop page Listeners
maleDragDropPage.menuBar.stop();
femaleDragDropPage.menuBar.stop();
maleDragDropPage.menuBar.topsButton.addEventListener(MouseEvent.MOUSE_DOWN,topsMenuShow_M);
maleDragDropPage.menuBar.trousersButton.addEventListener(MouseEvent.MOUSE_DOWN,trousersMenuShow_M);
maleDragDropPage.menuBar.shoesButton.addEventListener(MouseEvent.MOUSE_DOWN,shoesMenuShow_M);
//Event Button handlers
function startButtonClick(event:MouseEvent):void
addChild(tutorialPage);
function tutorialContinueButtonClick(event:MouseEvent):void
if (startPage.maleSelection.selected == true)
addChild(maleSizePage);
removeChild(startPage);
removeChild(tutorialPage);
if (startPage.femaleSelection.selected == true)
addChild(femaleSizePage);
removeChild(startPage);
removeChild(tutorialPage);
function maleSizeContinueButtonClick(event:MouseEvent):void
addChild(maleDragDropPage)
removeChild(maleSizePage)
function femaleSizeContinueButtonClick(event:MouseEvent):void
addChild(femaleDragDropPage)
removeChild(femaleSizePage)
// slider handlers
function heightSlChange_M(event:SliderEvent):void
maleSizePage.heightValue.value = maleSizePage.heightSlider.value;
maleSizePage.maleCharacter.height = maleSizePage.heightSlider.value + 280;
function neckSlChange_M(event:SliderEvent):void
maleSizePage.neckValue.value = maleSizePage.neckSlider.value;
maleSizePage.maleCharacter.neck.width = maleSizePage.neckSlider.value + 40;
function chestSlChange_M(event:SliderEvent):void
maleSizePage.chestValue.value = maleSizePage.chestSlider.value;
maleSizePage.maleCharacter.chest.width = maleSizePage.chestSlider.value + 141;
function waistSlChange_M(event:SliderEvent):void
maleSizePage.waistValue.value = maleSizePage.waistSlider.value;
maleSizePage.maleCharacter.waist.width = maleSizePage.waistSlider.value + 140;
function armSlChange_M(event:SliderEvent):void
maleSizePage.armValue.value = maleSizePage.armSlider.value;
maleSizePage.maleCharacter.leftArm.height = maleSizePage.armSlider.value + 180;
maleSizePage.maleCharacter.rightArm.height = maleSizePage.armSlider.value + 180;
function legSlChange_M(event:SliderEvent):void
maleSizePage.legValue.value = maleSizePage.legSlider.value;
maleSizePage.maleCharacter.rightLeg.height = maleSizePage.legSlider.value + 250;
maleSizePage.maleCharacter.leftLeg.height = maleSizePage.legSlider.value +250;
function heightVChange_M(e:Event):void
maleSizePage.heightSlider.value = maleSizePage.heightValue.value;
maleSizePage.maleCharacter.height = maleSizePage.heightValue.value + 280;
function neckVChange_M(e:Event):void
maleSizePage.neckSlider.value = maleSizePage.neckValue.value;
maleSizePage.maleCharacter.neck.width = maleSizePage.neckValue.value + 40;
function chestVChange_M(e:Event):void
maleSizePage.chestSlider.value = maleSizePage.chestValue.value;
maleSizePage.maleCharacter.chest.width = maleSizePage.chestValue.value + 141;
function waistVChange_M(e:Event):void
maleSizePage.waistSlider.value = maleSizePage.waistValue.value;
maleSizePage.maleCharacter.waist.width = maleSizePage.waistValue.value + 140
function armVChange_M(e:Event):void
maleSizePage.armSlider.value = maleSizePage.armValue.value;
maleSizePage.maleCharacter.leftArm.height = maleSizePage.armValue.value + 180;
maleSizePage.maleCharacter.rightArm.height = maleSizePage.armValue.value + 180;
function legVChange_M(e:Event):void
maleSizePage.legSlider.value = maleSizePage.legValue.value;
maleSizePage.maleCharacter.leftLeg.height = maleSizePage.legValue.value + 240;
maleSizePage.maleCharacter.rightLeg.height = maleSizePage.legValue.value + 240;
function heightSlChange_F(e:Event):void
femaleSizePage.heightValue.value = femaleSizePage.heightSlider.value;
femaleSizePage.femaleCharacter.height = femaleSizePage.heightSlider.value + 250;
function bustSlChange_F(e:Event):void
femaleSizePage.bustValue.value = femaleSizePage.bustSlider.value;
femaleSizePage.femaleCharacter.chest.width = femaleSizePage.bustSlider.value + 150;
function waistSlChange_F(event:SliderEvent):void
femaleSizePage.waistValue.value = femaleSizePage.waistSlider.value;
femaleSizePage.femaleCharacter.waist.width = femaleSizePage.waistSlider.value + 140;
function armSlChange_F(event:SliderEvent):void
femaleSizePage.armValue.value = femaleSizePage.armSlider.value;
femaleSizePage.femaleCharacter.leftArm.height = femaleSizePage.armSlider.value + 180;
femaleSizePage.femaleCharacter.rightArm.height = femaleSizePage.armSlider.value + 180;
function legSlChange_F(event:SliderEvent):void
femaleSizePage.legValue.value = femaleSizePage.legSlider.value;
femaleSizePage.femaleCharacter.rightLeg.height = femaleSizePage.legSlider.value + 250;
femaleSizePage.femaleCharacter.leftLeg.height = femaleSizePage.legSlider.value +250;
function hipSlChange_F(event:SliderEvent):void
femaleSizePage.hipValue.value = femaleSizePage.hipSlider.value;
femaleSizePage.femaleCharacter.hips.width = femaleSizePage.hipSlider.value + 160;
function heightVChange_F(e:Event):void
femaleSizePage.heightSlider.value = femaleSizePage.heightValue.value;
femaleSizePage.femaleCharacter.height = femaleSizePage.heightValue.value + 280;
function bustVChange_F(e:Event):void
femaleSizePage.bustSlider.value = femaleSizePage.bustValue.value;
femaleSizePage.femaleCharacter.chest.width = femaleSizePage.bustValue.value + 150;
function hipsVChange_F(e:Event):void
femaleSizePage.hipSlider.value = femaleSizePage.hipValue.value;
function waistVChange_F(e:Event):void
femaleSizePage.waistSlider.value = femaleSizePage.waistValue.value;
femaleSizePage.femaleCharacter.waist.width = femaleSizePage.waistValue.value + 140;
function armVChange_F(e:Event):void
femaleSizePage.armSlider.value = femaleSizePage.armValue.value;
femaleSizePage.femaleCharacter.leftArm.height = femaleSizePage.armValue.value + 180;
femaleSizePage.femaleCharacter.rightArm.height = femaleSizePage.armValue.value + 180
function legVChange_F(e:Event):void
femaleSizePage.legSlider.value = femaleSizePage.legValue.value;
femaleSizePage.femaleCharacter.rightLeg.height = femaleSizePage.legValue.value + 250;
femaleSizePage.femaleCharacter.leftLeg.height = femaleSizePage.legValue.value +250;
//Drag and Drop handlers
function topsMenuShow_M(event:MouseEvent):void
maleDragDropPage.menuBar.gotoAndStop(2);
maleDragDropPage.menuBar.maleTops.addEventListener(ListEvent.ITEM_CLICK,addTshirt1_M)
function trousersMenuShow_M(event:MouseEvent):void
maleDragDropPage.menuBar.gotoAndStop(3);
maleDragDropPage.menuBar.maleTrousers.addEventListener(ListEvent.ITEM_CLICK,addTrousers1_M)
function shoesMenuShow_M(event:MouseEvent):void
maleDragDropPage.menuBar.gotoAndStop(4);
function addTshirt1_M(event:ListEvent):void
trace(event.rowIndex,event.columnIndex)
if (contains(objTShirt[0+"_"+0]))
removeChild(objTShirt[0+"_"+0]);
if (contains(objTShirt[1+"_"+0]))
removeChild(objTShirt[1+"_"+0]);
if (contains(objTShirt[2+"_"+0]))
removeChild(objTShirt[2+"_"+0]);
if (contains(objTShirt[3+"_"+0]))
removeChild(objTShirt[3+"_"+0]);
addChild(objTShirt[event.rowIndex+"_"+event.columnIndex] as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN,tShirtDragPickup);
function tShirtDragPickup(event:Event):void
var currentDragObject:MovieClip = event.currentTarget as MovieClip;
currentDragObject.startDrag();
setChildIndex(currentDragObject, numChildren-1);
_isDragging = true;
currentDragObject.addEventListener(MouseEvent.MOUSE_UP, tShirtDragDrop);
function tShirtDragDrop(event:Event):void
var currentDragObject:MovieClip = event.currentTarget as MovieClip;
currentDragObject.stopDrag();
_isDragging = false;
currentDragObject.removeEventListener(MouseEvent.MOUSE_UP, tShirtDragDrop);
function tShirtTarget(event:Event):void
if (maleDragDropPage.objTShirt[0+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTShirt[0+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTShirt[0+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
if (maleDragDropPage.objTShirt[1+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTShirt[1+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTShirt[1+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
if (maleDragDropPage.objTShirt[2+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTShirt[2+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTShirt[2+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
if (maleDragDropPage.objTShirt[3+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTShirt[3+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTShirt[3+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
function addTrousers1_M(event:ListEvent):void
trace(event.rowIndex,event.columnIndex)
if (contains(objTrouser[0+"t"+0]))
removeChild(objTrouser[0+"t"+0]);
if (contains(objTrouser[1+"t"+0]))
removeChild(objTrouser[1+"t"+0]);
if (contains(objTrouser[2+"t"+0]))
removeChild(objTrouser[2+"t"+0]);
if (contains(objTrouser[3+"t"+0]))
removeChild(objTrouser[3+"t"+0]);
if (contains(objTrouser[4+"t"+0]))
removeChild(objTrouser[4+"t"+0]);
addChild(objTrouser[event.rowIndex+"t"+event.columnIndex] as DisplayObject).addEventListener(MouseEvent.MOUSE_DOWN,trouserDragPickup);
function trouserDragPickup(event:Event):void
var currentDragObject:MovieClip = event.currentTarget as MovieClip;
currentDragObject.startDrag();
setChildIndex(currentDragObject, numChildren-1);
_isDragging = true;
currentDragObject.addEventListener(MouseEvent.MOUSE_UP, trouserDragDrop);
function trouserDragDrop(event:Event):void
var currentDragObject:MovieClip = event.currentTarget as MovieClip;
currentDragObject.stopDrag();
_isDragging = false;
currentDragObject.removeEventListener(MouseEvent.MOUSE_UP, trouserDragDrop);
function trouserTarget(event:Event):void
if (maleDragDropPage.objTrouser[0+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.waist))
if (! _isDragging)
maleDragDropPage.objTrouser[0+"_"+0].x = maleDragDropPage.maleCharacter.waist.x;
maleDragDropPage.objTrouser[0+"_"+0].y = maleDragDropPage.maleCharacter.waist.y;
if (maleDragDropPage.objTrouser[1+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.waist))
if (! _isDragging)
maleDragDropPage.objTrouser[1+"_"+0].x = maleDragDropPage.maleCharacter.waist.x;
maleDragDropPage.objTrouser[1+"_"+0].y = maleDragDropPage.maleCharacter.waist.y;
if (maleDragDropPage.objTrouser[2+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTrouser[2+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTrouser[2+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;
if (maleDragDropPage.objTShirt[3+"_"+0].hitTestObject(maleDragDropPage.maleCharacter.chest))
if (! _isDragging)
maleDragDropPage.objTrouser[3+"_"+0].x = maleDragDropPage.maleCharacter.chest.x;
maleDragDropPage.objTrouser[3+"_"+0].y = maleDragDropPage.maleCharacter.chest.y;You are trying to assign undefined instances of class objects rather than define them...
objTrouser[0+"_"+0] = new trousers1;
objTrouser[1+"_"+0] = new trousers2;
objTrouser[2+"_"+0] = new trousers3;
objTrouser[3+"_"+0] = new trousers4;
objTrouser[4+"_"+0] = new trousers5;
should be
objTrouser[0+"_"+0] = new Trousers1();
objTrouser[1+"_"+0] = new Trousers2();
objTrouser[2+"_"+0] = new Trousers3();
objTrouser[3+"_"+0] = new Trousers4();
objTrouser[4+"_"+0] = new Trousers5();
and I didn't look deeper to see why you aren't creating the instances you declared (trousers1, etc) instead of objTrouser[0+"_"+0] etc. -
Call to a possibly undefined method displays when using static function in Unit Test
Hello!
This has been driving me nuts. I am setting up unit tests for a static class which manages a collection of songs. This is how my unit test class looks:
//START CODE
package flexUnitTests {
import com.myapp.managers.MusicManager;
import flash.utils.Dictionary;
import flexunit.framework.Assert;
public class MyAppManagerTest {
[Before]
public function setUp():void {
var songData:Dictionary = new Dictionary();
songData["mn0012345"] = new Dictionary();
songData["mn0012345"]["title"] = "All the Pretty Little Horses";
songData["mn0012345"]["description"] = "by: American Traditional | Voice, Piano | 3 pages";
MusicManager.setSongData(songData);
[Test]
public function test_getAuthorsBySKU():void {
var expected:String = "American Traditional";
var given:String = MusicManager.getAuthorsBySKU("mn0012345");
Assert.assertEquals(expected, given);
//END OF CODE
You will notice two calls in red above. When I leave them in the code I see a variety of errors which look like this:
"Call to a possibly undefined method '' through a reference with a static type com.myapp..."
And
"Access of possible undefined property '' through a reference with static type com.myapp..."
Then, when I comment out the two lines in red above, these errors go away. Flash Builder seems really flakey to me. Often I notice that the error list varies, how can it just no longer be an error? Where did this new access error come from, in a no related part of the code, by adding or removing a function call to a static class which remains in the import statement.
Note that the MusicManager contains no references to any of the UI mxml that is throwing these errors. It just simply loads data into a few globals and allows you to grab info.
How is my usage of this function making foreign objects inaccessible?
Please help!!! I am really hoping there is an answer but I have a bad feeling the answer is just that Flash Builder is flakey.I did some more work on the issue above. There are functions with in the MusicManager that call the UserManager to get a user's ID. When I comment out these calls then the access errors go away. Well the user manager has some calls back to mxml that tell the class that changes where made. My best guess is this is where it stems into the code that is randomly throwing errors. But, it compiles fine and runs fine on a device. Is there something with test cases which doesn't invoke the UI?
-
Call to possibly undefined method addChild
when i use addChild method in my class I got this message . Why it shows error "Call to possibly undefined method addChild"
ok that is the reasoning, add that and the import for movieClip to your class..
when you dont extend from any preexisting class.. object is used which does not contain an addChild method, therefore that method does not exist.
import flash.display.MovieClip;
extends MovieClip..
add those two things to your class and try again. -
Call to a possibly undefined method asyncResponder
Hi, why would I be getting this error for this code
token.addResponder(Async.asyncResponder(this, new AsyncResponder(onResult, faultHandler), 600));
1061: Call to a possibly undefined method asyncResponder through a reference with static type Class.
my imports look fine
import flexunit.framework.Assert;
import org.flexunit.async.Async;that method is only available in the flex version of flexunit. since it depends of an flex library class, it is not included in the actionscriptonly build
-
Hi I have a game set up, when you deplete your lives it takes you to a lose screen (Symbol), on that screen I have a button called Reset Game.
The button name is "Reset_btn"
The button instance is "resetbtn"
I have the code in the symbol and I am getting this error:
Symbol 'LoseMessage', Layer 'Reset_btn', Frame 1, Line 15 1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
Here is my code:
//Reset Button Code
resetbtn.addEventListener(MouseEvent.CLICK, Reset_btn);
function Reset_btn(event:Event):void
gotoAndStop(1);
I have given my button and instance name and a name for the button, why am i still getting this error, can anyone help?
CaseyOk.. so
This is on a separate timeline, its a movieclip which has a timeline inside it.
on frame 1 of that timeline inside the movieclip I have my button inside the movieclip.
The movieclip is activated when it meets a certain condition.
In this case when lives have been depleted to 0 from 3 a gameover screen appears.
A button is on that gameover screen which should take me back to the main menu or Frame 1 of the actual game in this case.
Here is the code for the condition for when game over screen appears:
if(cursor.hitTestObject(enemyAppear2))
enemyAppear2.parent.removeChild(enemyAppear2);
stage.removeEventListener(MouseEvent.CLICK, clickEnemy2);
life--
messageDisplay2.text = String(life);
if(life == 0)
enemyTimer2.stop();
var loseText:LoseMessage = new LoseMessage();
loseText.x = 0;
loseText.y = 0;
parent.addChild(loseText);
Mouse.show();
This code is in my main gaming code timeline.
The code im trying to show is inside the movieclip which i have set up.
Is this a clear enough explanation?
Maybe you are looking for
-
Is there a diagram for putting in a new hard drive in my early 2009 model imac 24 inch
Wanting to put in a bigger drive in my iMac. Have put plenty in a regular PC, but first time on my iMac. Looking for a diagram and compatible Hard drive info.
-
How to set user quotas on a certain filesystem
Hi It may be simple and easy question but I'm really new to this I need to know how to set user quotas on a certain file system in details I know it can be done easily in one step in Solaris ZFS but how is it done in Linux ? Thanks in Advance :)
-
Not able to autofill songs icon not showing up
when i plug my ipod shuffle into the usb port the icon under the souce section in itunes is not showing up so i can not autofill my songs does anybody know who to fix this
-
Nokia Music conversion problem!
As we all know, the newest PC Suite doesn't include Music Manager,being replaced with Nokia Music. I have a major problem: how do I convert (and then copy to my phone) songs from my PC to eACC+ format??...I searched all the menus and i don't see any
-
Why can't I head anything on my Ipod when I plug in my headphones?
I can't hear the music from my Ipod touch when I plug my headphones in and I've changed the headphones and it's definitely the Ipod. What should I do? Is there something I can do without taking it to a store?