[HELP] About Listener ' S Question Of Clip
I attachMovie a clip in root ' s layer . I need attachMovie other clip when first clip play the end of. How can I write this code.My english is not good ! :-P
Adobe > ActionScript 1 and 2
Posted on: 06/12/2007 06:35:54 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Listener For End Of Movie Clip
Hi. I've got a pretty simple question, well hopefully simple for everyone else, but unfortunately not for me. I've got a FLA where I'm trying to have my main timeline play a movie clip in a frame and wait until that movie clip finishes before it moves on to the next frame. I'm totally lost with this. I've tried to play around with eventlisteners but I'm a complete idiot when it come to actionscriptiong. Can someone please help? How should I handle the movieclip and it's timeline and the main timeline of my movie? Thanks!
Listener For End Of Movie Clip
Hi. I've got a pretty simple question, well hopefully simple for everyone else, but unfortunately not for me. I've got a FLA where I'm trying to have my main timeline play a movie clip in a frame and wait until that movie clip finishes before it moves on to the next frame. I'm totally lost with this. I've tried to play around with eventlisteners but I'm a complete idiot when it come to actionscriptiong. Can someone please help? How should I handle the movieclip and it's timeline and the main timeline of my movie? Thanks!
Using A Listener With A Movie Clip?
Hello,
I would highly appreciate it if someone can help me out. I would like to have a listener invoke a function when user clicks on the movie clip. This is what I have so far:
I have placed a movieclip called clip_mc on the stage and given clip_mc as instance name. On Action layer this is what I have:
PHP Code:
var myListener = new Object();myListener.onPress = function(){ trace("HELLO");}clip_mc.addListener(myListener);
Thanks.
[F8] Listener For Movie Clip Rollover
I working on a diagram of a skeleton.
For each bone in the body, I've got three movie clips, the image of the bone, the name of the bone and a line pointing to the bone. When the viewer rolls over the bone or the text clps they change colour and the line becomes visible.
This now works great, thanks to input from forum members.
Trouble is, my code for each bone runs to a few lines of script :
PHP Code:
// ------------thigh ---------\
this.thightext_mc.onRollOver = function() {
appear("thigh");
};
this.thightext_mc.onRollOut = function() {
fade("thigh");
};
this.thigh_mc.onRollOver = function() {
appear("thigh");
};
this.thigh_mc.onRollOut = function() {
fade("thigh");
};
For all the bones I'm doing that means quite a lot of code - though I've done hallf of them already! Is there a way I can cut down the code with a listener to detect which clip is being rolled over (and rolled out of) and extract the name of the bone from the movie clip name, as a string, and send that string to various functions ('appear' and 'fade')?
Event Listener For A Movie Clip
Hi --
I am trying to replace a stock button (from the components) with a movie
clip. The button has this code:
btnSubmit.addEventListener("click",sendData);
I deleted the button, btnSubmit, and replaced it with a movie clip with the
same instance name but that did not work. I tried the replacement as both a
"button" and a "movieclip". What is the correct event listener to get a
movie clip to fire an event when it is pressed/clicked?
Thanks
Rich
Movie Clip Loader Listener/preloader
ActionScript Code:
//movie clip loader
var MCL:MovieClipLoader = new MovieClipLoader();
//"center" listener
var centered:Object = new Object();
centered.onLoadInit = function(target_mc:MovieClip) {
//this is for center to stage
target_mc._x = 2 +( 757-target_mc._width)/2
target_mc._y = 40 + (458-target_mc._height)/2;
};
centered.onLoadProgress = function(target_mc:MovieClip) {
MCL.loadClip("files/loader.swf", imgLoad_mc);
imgLoad_mc.play();
trace("playing");
}
centered.onLoadComplete = function(target_mc:MovieClip) {
imgLoad_mc._alpha=0;
imgLoad_mc.stop();
}
nature2_mc.onPress = function() {
_root.gotoAndPlay("img");
//setup
over_mc._alpha=90;
//load+show
MCL.addListener(centered);
MCL.loadClip("files/nature02.jpg", img_mc,{_alpha:0});
img_mc._alpha=100;
}
Sorry to bother you all again.
This is concering my site: http://winterwish.net/ -> click on any image.
You find the preloader does not pop up...
The URL/instance names are correct, I double-checked.
loader_mc is a simple 5-frame repeating animation.
imgLoad_mc is a second dummy.
Is it because I'm adding the listener after I load the clip?
(I'm using the 2nd dummy because I'm not sure if I can get it to load the preloader, then load the image after. If anyone know how to do this, it would be much appreciated...)
Thanks in advance!
Movie Clip Not Picking Up Event Listener
Hello everyone. I'm working on a project where viewers can add movie clips to the stage with a button. Once the clips are on the stage, I want them to become clickable. To do this. I set up an event listener. But for some reason, it's not registering. Any ideas? Here is the relevant code:
Code:
var newLine:MovieClip = new MovieClip;
function selectThis(evt:MouseEvent):void{
trace("selected from new line");
}
function addClip(evt:MouseEvent):void{
newLine = new Line();
newLine.x = newLine.y = 100 + inc;
addChildAt(newLine,0);
inc++;
}
newLine.buttonMode = true;
newLine.addEventListener(MouseEvent.MOUSE_UP, selectThis);
Listener For Frame Label In Movie Clip
I'd like to create an 'addListener' that will trigger an action when a certain movie clip reaches a frame label in that clip. Is this doable? (I've never used 'addListener' or listener events).
Thanks for any help.
[shared Object] [listener] Attach Listener To SO?
Hi everyone,
I'm trying to build a simple sound control panel for voice-overs in an e-learning project.
I want to use one button to control whether or not users want sound played throughout the lesson.
Right now I'm using that button to write an SO that each audio file reads before playing anything. My problem now is if a user wanted to hear the audio after he or she has already entered the page. If a user clicks the audio-on button, it's simply changing the SO, not to be read until the next page and swf loads.
My initial thought was I could attach a listener to the SO, allowing Flash to interpret a change from OFF to ON and then start up the necessary sound files.
Would this work? I've searched and haven't found documentation for attaching listeners to SOs.
THANKS
Mouse Listener And Key Listener Problem..
Hi;
I used key listeners to detect the block in my crossword application but I have a focusing problem going on. I've tried everything but still couldn't find a solution. By the way I used a code that uses mouse listener to highlight the area I want to use but it sometimes craches the flash player. My .fla file is included in the message. Please help before I go mad.
.fla file :http://rapidshare.de/files/26952935/...2006_.zip.html
Thanks...
Listener Or ?
I have an interface that loads all other swf's and php into it.
My delemma is I want to set up one variable that is loaded from the php db after a user is logged in called "reg".
If "reg" has a value inserted in it from the db; Then have all the affected butons, mc's and swf's goto their registered mode.
I don't know how to set up the first part; I don't know the proper name for what I am trying to do. So I'm having trouble finding a tutorial on this subject. Which is making it hard to setup the second part.
Please Help;
Thanks
Listener Help
Had posted this in the MX room, but it's an Action Script ques, so here goes:
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 listener, 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 listener 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. Is a listener not the way to go??
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");
supListener = new Object();
supListener.onMouseDown = function() {
gotoAndPlay("1close");
_root.mainStage.gotoAndPlay("stop");
_root.SuperPlay.gotoAndPlay("SuperStop");
_root.SuperText.gotoAndPlay("SuperText");
};
Mouse.addListener(supListener);
}
----------------------
really appreciate it!
Key Listener
Ive read the AS dictionary and searched other posts
And still dont understand
I want a menu to ease in every time I have the M key pressed. And it to ease out ewhen I have the M key released.
I understand the easing, and have that code set up, but no matter what I just cant get the listener code to work, and I'm assuming this IS what I need
Key.Add Listener()
Hi,
does anyone know why Flash does not respond to the decimal and comma buttons on the keyboard.
function onKeyDown () {
var k = Key.getAscii();
trace (k);
}
while running this function, there is no response to these keys. Every other key works. I'm building a UI and really need these 2 keys.
thanks
With Or Without Listener
Hi,
How to return default value of List component to null i.e. List1.index = 0;?
Means if i scroll down scrollbar and with button (on (release) {bla bla})make a list component back to first item ... I ASSUME I WOULD NEED LISTENER BUT I WOULD LIKE TO TRY WITHOUT OR I'M WRONG ?
thanks in advance
Listener
I want to use a listener for to trigger a function.
Lets say the duration of a mc was 50 seconds.
When it reaches the 50 second mark I want the listener to call another function.
How would I use a listener for this?
I don't want to use setInterval or enterframe as there is far to many of them been used already and it is eating away at the cpu.
I don't know if this is true or not but I heard listeners are not hard on the CPU.
The only trigger when there called.
Or maybe I’m wrong. I'm new to listeners.
This is what I’m after but I want to use a listener or maybe someone has a better idea.
Code:
var dur=55
var position=timer.
if (position>=dur){
triggerFunction();
}
Help With Listener?
can anyone break down this code for me, i mean can someone please refrase the code to where i can make sense of it, and how i would use it? "laymans terms"
thank you as always:
Code:
var listenerObject.eventName = function(){
// your code here
};
Code:
broadcasterObject.addListener(listenerObject);
Code:
broadcasterObject.removeListener(listenerObject);
Listener
Can any object like a button or movie clip have a listener event so you can use it in the main timeline frame 1 if you like?
I am confused about what can be a listener event and what can't to use.
I am just talking about converting an object where you convert to a symbol, not a component.
I am confused ablout events and listener events as they appear to do the same thing. Can a button have an event and alisterner event in actionscript main frame (not in the actionscript for the button).
[F8] How Would I Add A Listener To This?
With the code below the function executes before I even call a start() on my fuse object. How can I avoid this? I imagine I need a listener of some sort but I have never used one before.
Here's what my code looks like now: code:
var lar1:Fuse = new Fuse();
lar1.push({target:_root.mc_1, Blur_blurX:25, Blur_blurY:5, seconds:.5, ease:"easeInBack", scope:_root.mc_1});
lar1.push({target:_root.mc_1, Blur_blurX:0, Blur_blurY:0, seconds:.25, ease:"easeOutBack", func:rollovertxt(), scope:_root.mc_1});
_root.mc_1.onRollOver = function(){
lar1.start();
};
function rollovertxt(){
_root.mc_1.txt1.setTextFormat(txtbg);
}
I would like the function to be called once the fuse tween is complete. How should I do that?
Key Listener
Hi guys,
I need to have the user to type (enter) in an input text field and then hit the enter key to go to another page. I'm trying to do it, but I'm stuck for some reason. Any help please?
See the attachment please!
[as2]Key Listener
Im using the following key listener to trigger a login function:
code:
var keyListener:Object = new Object();
keyListener.onKeyDown = function() {
if (Key.isDown(Key.ENTER)) {
login();
}
}
Key.addListener(keyListener);
However this triggers the login function twice, which causes the user to get a error saying they are already logged in. I have a button on the stage which triggers the same function.
code:
login_btn.onRelease = login;
And this works fine. Anyone have any ideas how I can ensure that the keylistener only triggers the login function once?
Thanks for any suggestions,
Harro
Listener Help
Hi,
I've got a function thats placing movie clips on the stage, and I need to make separate movie clips move to the next frame when you click them, but I'm not sure how to make them do that if the Delegate is inside a for loop, is it possible? do I need a listener or something?
here's my code:
public function setCubes ()
{
xArray = new Array ("10", "130", "250", "370", "490");
yArray = new Array ("15", "115", "215", "315");
memory.createEmptyMovieClip ("cubes", memory.getNextHighestDepth ());
while (lineNo <= 3)
{
memory.cubes.createEmptyMovieClip ("line" + lineNo, memory.cubes.getNextHighestDepth ());
memory.cubes.line0._y = yArray[0];
memory.cubes.line1._y = yArray[1];
memory.cubes.line2._y = yArray[2];
memory.cubes.line3._y = yArray[3];
memory.cubes.line4._y = yArray[4];
while (cubeNo == lineNo)
{
for (i = 0; i <= 4; i++)
{
memory.cubes["line" + lineNo].attachMovie("cube", "cube" + i, memory.cubes["line" + lineNo].getNextHighestDepth());
memory.cubes["line" + lineNo]["cube" + i]._x = xArray [i];
memory.cubes["line" + lineNo]["cube" + i].onRelease = Delegate.create(this, rotateCube);
}
cubeNo ++;
}
lineNo ++;
}
}
public function rotateCube()
{
}
Thanks
princess_b
Listener Help
I am having a problem, I have a var that gets set if my listener get fired off to tell me that it has been fired. So I put a while loop because I don't want anything to happen until my listener has been fired. Only problem is that locks up the movie. Is there something that I can do that lets me know that the listener has been fired?
IF Or LISTENER?
Hello all once again I am in a dilemma. First, thanks to Sophostikat for the help with the Tween/Transitions Class. I have definitely gotten what I wanted with that code help!
Now my issue:
I have three clips in my scene that move around the stage based on x and y positions. Now, what I need is a way to continually track when that clip has reached its destination so that I may fade in my album.
Do "if" statements continually run and evaluate? Or do I need to attach a announcer to tell a Listener to start the fade in animation once the clip has reached his destination?
Thanks in advance for the help!
¬badnewsblair
Key Listener
Hello Everyone
I need help!
Can anyone help me understand KeyListner functionality.
What I want to do is very simple.
I key value in the Textfiled and press Enter Button.
I should be able to trace the value enterned in my textfield.
For many in must be simple. So pls help
thanks in advance
Listener
Every object have events that you can simply code in the main frame1 eg object.onPress for a button.
I read the listener events are for object to communciate with each other as the main difference, but some objects i see have listener events but only deal with itself.
I am confused as to what a listener event is basically.
Should I Add A Listener?
I have a toggle button in my scene controlling audio levels. I also have a navigation bar movie clip, with nav buttons. When I hit any nav button, I want the toggle button also to react by executing the fade volume out function, if audio is playing. IOW, I want 2 buttons to react as if they are both being pressed at the same time.
Excuse my ignorance, but is this a potential job for a Listener object?
What Listener Mean ?
hello all,
if anyone understand what Listener mean please explain to me ?
i know how use it and i read many explanation but i can't understand it
any help well be great
Regards
Crimson
Would I Use A Listener Here?
Hey everyone,
I have a somewhat complex button that when I rollover it performs a couple different animations. When all of these animations are completed I want another movie clip to perform an action
Here is my code
Code:
btn.onRollOver = function(){
_root.tab01.dep = _root.tab01.getDepth();
_root.tab01.swapDepths(_root.tab01.getNextHighestDepth());
_global.startMove.call(tabBtm, 12, -18, 142, 85)
_global.startMove.call(tabTop, 12, -193, 142, 211.8)
_global.startMove.call(dropShadow, 0, -19, 142, 26)
_global.startMove.call(image, 12, -18, 142, 85)
_global.startMove.call(tabText, 12, -190, null, null)
_global.startMove.call(description,12,-140,null,null)
}
}
The last item with description as the target is what I want to happen last. I thought if I could somehow track the postion of 'tabText' so that when its _y is = -190 my last animation would execute.
Does anyone have any suggestions?
What Exactly Is A Listener
Im guessing that a listener is a invisible object in a frame? Is that correct. Im also guessing that in order to create a Function to be called You have to first create a listener like below
listener = new Object();
Listener.KeyUp = Function() {
Your Code......
}
?? Am I correct. Or In order for a function to respond to a users reaction. You have to create a listener like above. And a regular Function can be created but only behind the scenes. Someone help me out here
What Is A Listener
Do anyone in here know whats Listener? I would like to know more about it.
Key Listener
I am using a key listener to get the space bar to control a movie within a movie. I can see the (32) is the space bar and (16) is the shift key. Is there a reference for what number controls what keys? I have others that I want to use, but I don't know what controls what key.
Thanks,
Rich
Listener On Ftp
I know this is not the best place to ask, but since it's the best forum I know I'll try.
I have a flash upload function. How can I create a listener on my ftp that sends me a mail or whatever when a new file has been uploaded to the ftp folder..? Can I make one myself, and which language is it done with? Can't find any basic info on the net.
Listener Help
I ahve several button objects on stage and I am looking for a way to have them return their instance names or other properties without having to write a code for each. for example, for the button gaur_btn, I have
gaur_btn.onPress = function ()
{
trace(gaur_btn._x);
};
which return the x position of the button. How do I make it generic so that I do not ahve to write this for each button? Otherwise I will have tor epeat this 100 times for the 100 buttons I have which just doesnt look right. Help appreciated.
Key Listener
I'm a bit new to actionscript and does anyone know how to make a function for a button like the E key or something? cause everything I made before was with the arrow keys or the enter key or something
Can I Do This With Listener?
if have a prototype like this
Code:
MovieClip.prototype.moveToXY = function(xPos, yPos) {
this.onEnterFrame = function() {
difx = xPos-this._x;
dify = yPos-this._y;
if (Math.abs(difx)>1 || Math.abs(dify)>1) {
this._x += difx/5;
this._y += dify/5;
} else {
this._x = xPos;
this._y = yPos;
delete this.onEnterFrame;
// ready
}
};
};
can i track that "ready" state with listener? -> when the object has moved to new place x,y -> other function should start..
because i'll use that prototype with many mc:s i can't call the function in that prototype!
so, can somebody help me?
Key Listener
My key listener is working fine but not as good as i want it. the program responds at every key press but I want about 2 seconds delay before program would respond to another key press.
AS
listen = new Object();
listen.onKeyDown = function() {
if (key.isDown(key.getCode())) {
nextFrame();
}
}
Key.addListener(listen)
Why A Listener?
Hi,
I don't understand the principle: why do you need a listener for, e.g. a moviecliploader object? Can't you just make an instance of the object Moviecliploader, upon which call all the methods and properties? Like many other objects, like TextField, for example?
It's somehow confusing to me :
thank you very much
m.
Var Listener?
is there a way to make a listener for a variable?
i want this function called everytime a specific variable is changed.
i guess i could use a setInterval(function,10) but that would majorly suck.
About Listener
I don't understand what's the main purpose of listeners, like there's already onEnterFrame and onRelease and etc etc all that stuff, why should we set another listener for Mouse? any good example which shows how listeners works perfectly?......thanks.
Key Listener Or Key Down
i have created a script that builds a string from the chars as they are typed into the keyboard, however, i cant seem to make the script stop when ENTER is pressed and return the string into the clip? i have used the do-while however, when ENTER is pressed the system thinks for minutes and returns nothing!
i have a feeling this is a little 'noob' but it is a genuine actionscript question.
Listener Help
I am not a actionscripter, so please be patient with me.
Basically I have 2 functions that handle a transition - CloseWindow(), and OpenWindow(); Each of these contains a tween that opens and close a window. A movieclip will be attached to the Window while it is closed, then it will call the OpenWindow function.
My problem is that the movie is attached and the OpenWindow function is called before the tween contained in CloseWindow() is finished.
I know that I probably need to do something with listeners. I am stuck, and starting to get a bit frustrated. Any help would be greatly appreciated.
Here is a watered-down/pseudo-code version of what I am doing.
function CloseWindows() {
//close tween defined here
}
function OpenWindows() {
//open tween defined here
}
function LoadPortfolio() {
if window is open
CloseWindow();
//remove currently attached movie
//attach movie here
OpenWindow();
}
I know that I can use theTween.onMotionFinished, but how can I tell the code in LoadPortfolio that the window is closed and that mcs can be removed and attached? Since the tween is defined inside of the CloseWindow function, I am unable to access it.
Please help me :P
Listener
I know i'm pretty close...I guess i'm just not calling the listener correctly...I'm trying to get it so that each individual movie has a timer...and you have to press a key before the timer is over with. So, let's say they have to press "D" before two seconds is up...what do I have to add to my code here...(so that x will equal 2 if they press it in time?) Thanks!
ActionScript Code:
onClipEvent (load) {
var myListener:Object = new Object();
myListener.onKeyDown = blastHim;
Key.addListener(myListener);
x = 0;
}
onClipEvent (enterFrame) {
setInterval(function () {
x = 1;
trace(x);
}, 2000);
if (x == 1) {
this._alpha = 20;//means you lose...i've got other script here...
}
function blastHim() {
if (Key.getCode() == 69) {
x = 2;
}
}
}//and if x is 2...then another movie appears...
Listener Help
can anyone send me a url that explains and demonstrates listener objects?
[AS] Add Listener
Hi, I was trying to play around with "addListener" it just won't work, here's the code:
ActionScript Code:
var myPoop:Object = new Object();
myPoop.click = function(){
trace("you just clicked my poop");
}
myBtn.addEventListener("click", myPoop);
it doesn't work, any ideas?
and why do I need addListener? since there are so many build in methouds...what's the point of "addListener"???
Listener?
I am loading some content using Loadvariables.
What i used to do in this situation was make a 2 frame MC with
if (variable != "")
{do stuff that requires variables}
this clip would loop untill the variables were loaded.
Now this seem very ineficient and I have heard about something called .addlistener
Does anyone want to give me a quick rundown on listeners and how I might use it in this situation?
THX!
MC Listener From XML
Hello,
Does anyone know of a good tutorial on how to have an external file from XML converted into a MC and then be used as a button?
I will try and explain better I have a MC that loads a .jpg from an XML file. I would like to have this .jpg converted to a MC. This new converted MC then has the ability to be used as a button to go to an URL and not just any URL but a specified URL that is in the XML File.
The only example I have is at kernkonnection.com within the portfolio page. The different .jpg's loaded are what I want to become my links.
Hope I explained it ok.
Thanks,
tmoflash
|