Key Listner
I am using a listner to call a menu in a game I am fiddling with. code: listen = new Object() listen.onKeyDown = function() { if (Key.isDown(27)) { attachMovie("menu", "menur", 2); menur._alpha = 50; menur._x = 137.5; menur._y = 100; } }; Key.addListener(listen);
It dosent seem to do anything when I push escape, which 27 happens to be. Can you spot my problem?
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-27-2003, 07:51 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listner?
What is a listener?
Thanks,
1M.
Listner Problem
Had been having trouble w/ a button and some movie clips:
Used to be, default movie wouldn't stop when secondary movie played (onMouseDown & rollOut).
Added a listner, works -- problem is, once listner is activated, anytime anyplace on the stage is clicked, default & secondary movies toggle.
Really annoying, 'cause 1) secondary movie is scroll text and 2) have like 4 of these buttons, so movies play on top of movies.
Any way to deactivate listner once mouse is rolled out of button?
I thought that bec code is in the button timeline, button would be hit area, not entire stage.
Here's code:
----------------------
on (rollOver) {
gotoAndPlay("1open");
_root.mainStage.gotoAndPlay("stop");
_root.SuperPlay.gotoAndPlay("SuperGo");
}
on (rollOut) {
gotoAndPlay("1close");
_root.SuperPlay.gotoAndPlay("SuperStop");
_root.mainStage.gotoAndPlay("stop");
supListner = new Object();
supListner.onMouseDown = function() {
gotoAndPlay("1close");
_root.mainStage.gotoAndPlay("stop");
_root.SuperPlay.gotoAndPlay("SuperStop");
_root.SuperText.gotoAndPlay("SuperText");
};
Mouse.addListener(supListner);
}
----------------------
really appreciate it!
Listner For Flv Playback
I need to come up with a listner that detects when an flv file has played to the end. Since I am using the FLV playback component I thought of comparing the Totaltime with the playheadtime but not sure how to set that up in a listner. Any ideas or starting pointers?
-mx
Fullscreen Listner.
Saw someone did this on the forum
But i couldnt find that post!
What he/she did was something like this:
ActionScript Code:
fsListner = new ObjectfsListner.onChange = function (){fscommande("fullscreen",true)}
which makes users unable to exit fullscreen...
any ideas?
Event Listner
How Event Listner Works And if they simillar to other events
why we use it for?
thanks
Event Listner Question
the following code is an event listener which listens for click....I can't find any refrences that tell me what events i can use other than "click" ....will you please give me the other events or point me at a refrence webpage?
Code:
my_btn.addEventListener("click", loaditx);
OnResize Listner? Or OnEnterFrame
Hello,
I have wrote a scroll class and have a question. I want to make a listner which listen to the contentholders height. when it is "resizing" is must call a function (to set the scrollbar again). So if the contentholder is resizing (growing larger or smaller) it must execute a function.
I can do this also bij checking the size with a onEnterFrame function on the contentholder but don't know if this is better (regarding CPU and memory) than an listner.
if someone coult help me with this.
Thanks!!!
Listner Targeting Nested Clip
Hello,
I'm trying to target a listner to clip3 only. However, I'm unable to target or restrict the listener to just the nested clip. The listener behavior almost seem global, no matter what or where I click on the stage the function is "f do" function is called.
//listening object
mylistener = _root.clip1.clip2.clip3;
//to do
fdo = function(){
_root.clip1._x+=100;//path reference now works
trace(this);
}
//listener, listen to mouse
Mouse.addListener(mylistner);
//call function
//activate function
_root.clip1.clip2.clip3.onMouseDown = fdo;
Movie Clip Loader With Listner
I'm trying to use the MovieClipLoader, so far without a lot of luck. I cannot get a trace message in debug whether or not Flash_Navbar.swf exists.
Attach Code
var navbarLoader:MovieClipLoader = new MovieClipLoader();
var navbarListner:Object = new Object();
navbarLoader.addListener(navbarListner);
navbarListner.onLoadComplete = function() {
trace("load successful");
};
navbarListner.onLoadError = function() {
trace("load error");
};
navbarLoader.loadClip("Flash_Navbar.swf",2);
Event Listner Not Owrking In External As File.
Hi,
I'm stuck please help.
I'm converting a web site to flash, and because we need to use the same template for all pages and because it most be easy to change the images, I'm loading images and menu items in an external *.as file and import this file in every page.
The problem arise when I want to add mouse listeners to some movie clips for linking to other pages, It's not working at all. I think it's because I'm creating listeners in external as file. But I have to. The same code work when I test it on a normal movie clip.
I'm using flash 8 and actionscrip 2.
this is a piece of code :
var mc:MovieClip = _root.createEmptyMovieClip("mc", this.getNextHighestDepth());
mc._x = 50;
mc._y = 50;
myLoader.loadClip("image.png", mc);
mc.onRelease = function(){
trace("aaaa");
}
Some one suggested creating another movie clip and adding listener to it, but it didn't work.
Also I tried to add listener after loading images and it didn't work either.
I'm in real trouble. Any help is appreciated very much.
Thanks.
Adding Event Listner Inside A Sprite Problem
I am a great AS2 programmer. Not really the best but I can get the job done. I finally decided to start doing all my jobs using AS3.
So I am having trouble writing eventListeners to buttons in my project.
Here is the situation. I created a swf file in Flash cs3 and then created a swc file and added it to my project in Flex Builder. I am pretty sure that is installed correctly because Flex Builder is giving me code hints for all the symbols in my swc's library.
I created an empty Sprite and then I am going to addChild objects to that sprite.
Once I add these assets to the Sprite I would like to add Mouse Events to some of the objects that are placed inside of the sprite.
Here is some code that I have set up.
Code:
public function StarisMain(){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
_maincontent = new Sprite();
_maincontent.x = (stage.stageWidth - 900) / 2;
addChild(_maincontent);
///this is the background for the stage
var _background:StarisBackground = new StarisBackground();
_maincontent.addChild(_background);
var _featuredButton:StarisFeatureButton = new StarisFeatureButton();
_featuredButton.x = 433;
_featuredButton.y = 509;
_featuredButton.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
_maincontent.addChild(_featuredButton);
stage.addEventListener(Event.RESIZE, centerContent);
}
private function onMouseOver(event:MousEvent):void{
trace("you clicked");
}
the private function onMouseOver is giving me an error of Type was not found or was not a compile-time constant.
the function is for the _featuredButton var that I have set up.
I have tried writing and event listener for _maincontent._featuredbutton and I get the same error.
Flash MX 2004:I Want To Add A Event Listner On MenuBar Component
Hi all,
I am very happy to join this community.This is my first Post.
I have made a Horizontal Menu bar usin MenuBar Component, name it "myMenuBar"
I use addMenu to add menus to this bar.
Then I add event listners for menus using addEventListner("change",File) it work fine.
But I add a menu HOME var home = myMenuBar.addMenu("HOME");
that not have any items(child), Now I want to add listners to this Menu, means Whenever I click HOME label on MenuBar a function have to call How this can happen?
Although I use myMenubar.addEventListner("focusIn",var1); It work for once, but it is for all menus...
If anybody can help me please send your kind reply
Yogendra
|