ActionScript 2.0 :: Can't Access Listener Object From File
Apr 16, 2007
Trying to access a listener that I have created in a .as file from within a .fla file. My chapters.as class is as follows:
Code:
// Define Chapters
class Actions.chapters {
// Constructor function that is called from external swf file
[Code]....
how I can access this properly or do I have to define the listener object within the .FLA file?
View 2 Replies
Similar Posts:
Feb 11, 2008
I am having a weird problem with scope/reference. I am using a loop to preload a number of thumbs in one go, I am creating a different listener for each one on the fly and then passing event handlers for each one of them. This should not be difficult using a loop, but somehow I cannot access the the parent object on my listener and therefore I can't do much with my thumbs after they are loaded.Here is the relevant segment of my code. myThumb_mc is a temporary variable that does not exist when the loop finishes, you can copy and paste this code to test it though. It should work to that extent. (you'll need an image1.jpg to be in the same directory)
Code:
var myThumb_mc = _root.createEmptyMovieClip("myThumb_mc", _root.getNextHighestDepth());
myThumb_mc.clipLoader = new MovieClipLoader();
myThumb_mc.clipLoader.loadClip("image1.jpg",myThumb_mc);[code].....
The code above works, but it does not look nice and it cannot be the right way of doing this. Long question short, how can I access the parent of a listener from a listener object? ._parent does not work.
View 9 Replies
May 27, 2011
I made a movie clip that is linked to a class named "Fugel". In the "Fugel" class I want to access the object's properties (x, y, rotation, alpha...) that I created in the main FLA file. I'm trying to center it in the constructor, but I don't know how to. The "this" keyword doesn't seem to work.
Here is the code for the "Fugel" class:
Code:
package {
import flash.display.MovieClip;
public class Fugel extends MovieClip {
public function Fugel() {
[Code].....
View 5 Replies
Apr 5, 2005
Here's some background: I am working on a project in which we have one main Flash file that loads other Flash swfs into an empty movie clip within the main file.The main file instantiates a class I've made (stateManager) into a _global variable.This object keeps track of the most recent states of the other individual files so users can navigate between them all and come back to the same status they left it.Here's the issue:In the sub files, I need to access the _global object, which was created in the main file, many times so I would like to use the 'with' construct to reduce typing. However, because the 'with' statement needs an object to reference, I am unable to publish my files .I've tried adding an if-statement at the top of each file (if(_global. stateManager == undefined){ ), but this doesn't work either.I've included a portion of my code for you.
Code:
import classes.stateManager;
if (_global.stateManager==null) {
_global.stateManager = new classes.stateManager("./InitFiles/global.xml");[code]....
View 1 Replies
May 12, 2010
I have extended an mxml component with an actionscript class. I'm trying to access a component in the mxml file using the id (in order to add an event listener) but I cant seem to do it.
I get:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Mar 26, 2011
Alright, I've looked online at a bunch of different collision tutorials but they don't explain what I'm looking for. I want object A to hit object B and then execute a function via to a Event listener.
View 1 Replies
Sep 2, 2010
I'm experiencing a problem that I've having difficulty solving. I built a project in CS4 using AS3. Everything worked fine. Unfortunately, it needed to be accessible via CS3 (the person using the file doesn't own CS4). No problem. I converted it to CS3 - and now I'm receiving this error:
[Code]...
View 7 Replies
Aug 4, 2009
I am new to flash. I am experiencing random (at least to me) errors (#1009) while navigating through my tested file. I can't reproduce them everytime. It only happens sometimes. Usually they occur after I have clicked back and forth between different pages (frames). Sometimes the error shows up once, and the file moves on as if nothing bad has happened. Sometimes the error continuosly displays, which really slows down the test. One example of such: TypeError: Error #1009: Cannot access a property or method of a null object reference. at About28_fla::MainTimeline/clickResumeFromAbout()
View 7 Replies
Dec 15, 2009
I want to a listener on a tween on the document class that when it's finished, it goes to it's child's listener function, but I don't know how. I thought it'd just be a case of document.functionName but it's throwing an error.
[Code]...
1061: Call to a possibly undefined method startFade through a reference with static type Class.
View 3 Replies
Jul 7, 2009
I'm having a real difficulty in action script 3 using my xml data from an external source. I have no difficulties importing or manipulating the xml data, the difficulty lies in accessing the information in a different function.
[Code]....
View 8 Replies
Oct 20, 2010
It's too complicate to explain but I'll give you an example
I have an AS3 ResultEvent Object and this object has several propeties which can be accessed by this like:event.result.name or event.result.age and, I have this String variable: eventProperty:String that contains "name" or "age" How do I access to event.result. with the variable?
View 2 Replies
May 12, 2009
I'm using the following addlistener to listen for a custom event the event works if i put e.Event in the functions parameter but i don't get the passed variables however if i go into the .as folder where the dispatch originates and put EventType in the parmeters field of the function then i get all the variables.........but if i put EventType instead of e.Event in the first example then I get undefined for EventType.....how do give access to EventType?
[Code]...
View 7 Replies
Apr 15, 2008
I'm having trouble with buttons. I've tried two sets of code and get the same result: an "1120: Access of undefined property enter_btn" error. Here are the two sets of code I am using:
Code:
function onEnterClick(evt:MouseEvent):void {
gotoAndPlay(71);
}
[code]....
I've set the instance name for the button but keep getting the error. Do I need to set up a variable first?
View 9 Replies
Dec 30, 2009
stage.addEventListener( MouseEvent.MOUSE_DOWN, clicSouris);
function clicSouris( pEvt:MouseEvent ):void { var positionX:Number=pEvt.stageX; var positionY:Number=pEvt.stageY;
[Code]....
what appens when I add an Event Listener to Object Event?
Following the logic with the display list in AS3, I thought only Classes who inherit flash.display.InteractiveObject could react from events coming from mouses (or keyboard).
View 5 Replies
Jan 29, 2012
trying to find how to assign listener to an object created with this function...
Code:
private function placeBtn(thumb:String, Xthumb:Number, Ythumb:Number, targetHolder:MovieClip, ID:String):void{
var clipHolder:MovieClip = new MovieClip();
[Code]....
View 5 Replies
Jan 7, 2010
I am developing an application with Flex for the GUI and Restlet for the webservices. I have a strange problem. I put my XML as a property on a generic object, and send it as part of a POST request. But in the Restlet webservice, this XML is irretrievable. How do I retrieve it? I tried initialising the received Representation object to a DomRepresentation, but thats not working. If I put the received Representation object into a Form object, then getFirstValue is returning that XML as a string! I noticed that the contentType of the HTTPService was application/www-form-encoded so I set it to application/xml and its not helping either. I use restlet 2.0m6 and here is the code snippet that I use -
[Code]...
View 1 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.
this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
[Code].....
View 2 Replies
May 31, 2011
I have four buttons named button1, button2, button3 and button4. I want the code to trace the name of the button when the button is clicked. This is just an eample of what I'm doing in my project. The project itself is too convoluted to put up and explain. My problem that needs to be solved is, how do I refer to the button in the Function?
var c:int;
var buttonName:String;
for (c = 1;c < 5;c++) {
buttonNum = "button"+c;
[Code]....
When I say "trace(this)", the code doesn't know what "this" is because I've taken this[buttonNum] out of the loop by having to put it in a Function. How do I call to the object that is in the listener that called the Function?
View 8 Replies
Jul 29, 2009
ActionScript Code:
/* Setup listener for each video/audio cue point ============ */
myListenerObject.cuePoint = function(evt:Object):Void {
if ((evt.info.time == cpTime[n]) || (evt.time == cpTime[n])) {
[Code]....
The code above does not work because of the if/else if statements. What I'm trying to accomplish is that I have a listener object that in one frame listens to an flv playback object, and in another frame listens to an mp3 file.
The listener code for both types are exactly the same, except that the flv listener uses the evt.info.time to check for cue points in the flv and the mp3 uses evt.time to listen for the cue points in the audio. Since I can't combine these with an OR operator, is there any other way to consolidate these two, or do I just need to keep two sets of the same listener code for each to refer to?
View 1 Replies
Jul 23, 2011
i am trying to access an object within a class and the object is comming up as null but i dont understand why.this is the object:
btnLMain = new MovieClip(); //variable declared earlier in code
btnLMain.name = "btnLMain";
btnLMain.clickNum = 0;
addChild(btnLMain);
this was created in the class: LanguageButton. here is how i declared the above class within the class i am trying to instantiate it:
var btnL:LanguageButton;
then i try to access the btnLMain from the LanguageButton Class and it, (btnLMain) is comming out null:
btnL = new LanguageButton(cssLoader);
main.addChild(btnL);
btnL.btnLMain.addEventListener(MouseEvent.CLICK, btnLClick);
View 2 Replies
Apr 27, 2009
I have a movie clip being dynamically added to the stage via an AS3 linkage call:
gameOver_mc = new GameOver();
stage.addChild(gameOver_mc);
The movie loads as required.But when the movie has been added I want the user to be able to press spacebar and a function to run.So in the GameOver.as class I wrote the following:
Code:
package
{
import flash.ui.Keyboard;
[code]...
But as soon as the movie clip tries to load I get the error message: TypeError: Error #1009: Cannot access a property or method of a null object reference.I would have thought this would work fine. When I trace the statement in the Constructor function is works. Its only when I try to add an event listener that I get the problems. So am I not allowed to add event listeners from a dynamically loaded class?
View 2 Replies
Apr 23, 2010
$("#listView object.modal").click(function(){
// Get the ID of the clicked link:
var link = $(this).closest("h2").attr("title");
[Code]....
This fires a modal (jQuery UI). It it working in FF, Chrome/Safari but not in IE 7/8. Is there something I'm missing here?
Big Picture: We're using a swf to render custom type and there is a link in the rendered (flash) content. We're hoping to catch the link action in the jQuery listener so we don't have to extend our swf have an optional param to return false on link click.
View 1 Replies
Feb 23, 2009
I'm trying to add an event listener inside an object but it doesn't seem to work. other OO languages it makes sense for an object to be able to attach events etc itself rather than have some external action do it.Here's an example of what I'm trying to do:
ActionScript Code:
package {
import flash.display.MovieClip;
public class Player extends MovieClip {
[CODE]....
This gives an error "1120: Access of undefined property MouseEvent." suggesting that I don't have access to MouseEvent from within the instansiated object.What I can do is create an instance of the class from the Document Class for example and then do the following:
ActionScript Code:
newInstance.addEventListener(MouseEvent.CLICK, newInstance.mouseClick);
View 1 Replies
Apr 27, 2009
run event listener through dynamic object call
View 1 Replies
Mar 22, 2010
I'm pretty new to AS3, but I have not managed to solve the following problem: basically adding instances of a bitmap on the stage (working), but then adding an event listener and knowing which is which. So for the first part:
[Code]....
View 2 Replies
Apr 21, 2011
I have to develop an application in flex. In that application an user can draw line while dragging the mouse. Then if he clicks on that line it should be selected. How to add mouse click event listener to a line object?
View 3 Replies
Jan 28, 2010
I have two scenes in flash - when you go to scene 2 there is a eventListener attached to the stage to move a movieclip. When I test the movie the only way the keyboard listener seems to work is if I click on the stage first, then the object will move. Is there a solution to this. The code I am using is:
[Code]...
View 5 Replies
Jan 18, 2011
So I have two movie clips linked with classes- one with the class "theList" and one with the class "challengeBar". I need to use a function in challengeBar to access a function in the theList. They are both immediate children of the stage.so for now I have this (in the challengeBar class)-
public function populate(){
this.textBox1.text = myList.dequeue();
}
should it be something along the lines of root.myList.dequeue? or stage.myList.dequeue? How can I access that function?
View 2 Replies
Feb 19, 2010
is it possible to determining what object calls a function based on an event listener? for example, i have 2 buttons on stage that call the same function when they are clicked. i'd like the function to determine which button was the sender.
[Code]...
View 3 Replies
Feb 15, 2011
Ok I have this 100% width/height Flash embedded and when the user moves the mouse I want to display a panel, which disappears after x seconds if there is no more mouse movement.
I think I need an addEventListener, but I am not sure MOUSE_MOVE is the correct one. When the mouse stops moving I need to start x seconds to hide the panel, so I think with a timer?
[Code]...
View 1 Replies