My Own Events
Hi. I want to define events for my classes, so when I use these classes I will be able to use the addEventListener.
but how?
thx.
I don´t know if I´m clear.
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 10-02-2007, 01:10 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Register Classes - Mc Events Vs Button Events
I'm experimenting with register classes today, and wasn't careful typing the code with only button events for my custom movie clip class.
First I wrote
Code:
CustomClass.prototype.onMouseDown = function(){
this.gotoAndStop("blue");
}// end onMouseDown
Then all the mc-buttons in my movie went to the blue state. (.fla provided)
When I realised the error, I corrected it, and now it works.
I just don't understand what happened.
Do Movie Clip events turn out to be class methods (don't know what to call it in Java script, only used to Java), while button events stay instance events??
Hope somebody have the time - it's not about life and death, but it would be really nice to know how these things work.
Respond To Mouse Events Inside A Movieclip That Has Mouse Events...
I have a main MC that has a couple of mouse events associated with it (onPress mainly). There are also MC's inside this main MC that have Mouse events associated to them (onPress, onMouseMove, onRelease). The child MCs don't seem to get the mouse events (which makes sense, the parent is taking over the event)...how can I make this work? I don't want to have to delete and recreate the event handlers like 900 times as its not efficient...there has to be a better way.
Can Events Trigger Other Events?
Hello brothers and sisters of the Nets most helpful community!
I am going insane in the membrane trying to get my custom cursor to work in my scene. I have successfully completed many tutorials about how to do this in AS3 (the danielmclaren.net solution was particularly helpful) and have scoured this forum a bit for info, and (gasp) also read through a bunch of stuff on live docs. But, alas, I cannot understand why I cannot get the custom mouse (cursor) to work in my file. It works like a charm until I try hammering it into my scene.
I believe that the problem has something to do with with too many events being fired off at the same time and (possibly) my not removing them at opportune times. Or, maybe my coding style is not so elegant? Anyway, the FLA (with easy-to-read structure and commenting) can be downloaded here since I am not certain which part of my code is causing the custom cursor not to work. With all the comments, it should not be too difficult (I hope) to see what it is I am trying to do.
Any feedback would, as always, be most appreciated.
Download_FLA
Regards,
-john
Key Events?
ok people i am using the the number keys 1, 2, 3 and 4 to navigate through my site. im also using using multiple swf's on multiple levels all loaded into one main movie. i put a button in my navigation level that has the actions for keypress 1,2,3,4. now im loading my guestbook onto a higher level, but if you press 1,2,3,4 you get taken to a different part of my site. is there anyway to set the focus of these keys or make them stop while that level is loaded???
confuesd? me 2
check it out for your self
http://www.sub7designs.com/test/jon.html
press 4 then try to enter a number into gbook and you see what i mean
thanks
Key Events
hallo,
is it possible to catch 2 key events at once in flash 4?
I've got a 2-player flash pong. During one player presses a key to move
his paddle, the other player can't move his paddle because flash doesn't
catch the other key event.
I've got 2 invisible buttons (one for each paddle) to catch the key
events.
Thanks in advance,
ute
Events
Why the f*ck doesnt this work:
function test() {
this.callback();
}
test.callback = function(){
trace("callback");
}
test();
thank you all.
::mate::
Can Do Any Two, But Not Three Events Together
What should happen:
When a user clicks a nav button, the main movie should advance to a frame label with anchor. Next, an already loaded movie should play at frame 2, and lastly a different movie should load to a movie clip target.
The problem:
I can get the main movie to advance to the correct label and either load a movie or play the already loaded other movie. But not do both.
The code:
-- Nav button
on (release) {
gotoAndplay("labelnamedX");
}
-- At frame label on action layer
_root.alreadyloadedmovie.gotoandplay(2);
loadMovie("NewMovieToTargetMC.swf", "_root.holder");
stop();
--Thanks in advance
Greg
Key Events
Is it possible handle key events inside classes?
If so, how to addListener to the Key object inside a class?
Events
I am trying to set up a simple generic event handling class but its not working for some reason.
This is the Object.as file:
Code:
Object.prototype.startListeners = function(propName) {
this.watch(propName, this.propSet);
};
Object.prototype.addListener = function(listener) {
//check to see if the listeners stack exists
//and create it if it doesnt
if (this.listeners == undefined) {
this.listeners = new Array();
}
this.listeners.push(listener);
};
Object.prototype.removeListener = function(listener) {
for (var e = 0; e<this.listener.length; e++) {
if (this.listeners[e] == listener) {
this.listeners.splice(e, 1);
break;
}
}
};
Object.prototype.propSet = function(prop, oldVal, newVal) {
for (var e = 0; e<this.listeners; e++) {
//trace(e);
this.listeners[e]["on"+prop+"Change"](oldVal, newVal);
}
//return newVal so it is assigned
return newVal;
};
and in the fla I have made a class and tried to watch the returnval property for change. That code is:
Code:
_global.dh = function(val) {
this.returnVal = val;
};
obj = new Object();
obj.onReturnValChange = function(oldVal, newVal) {
trace("returnVal has changed from "+oldVal+" to "+newVal);
};
aDataHandler = new dh(10);
//add obj_listener as a listener
aDataHandler.addListener(obj);
//start listening for returnVal
aDataHandler.startListeners("returnVal");
//test event handler
aDataHandler.returnVal = 5;
aDataHandler.returnVal = 53;
why oh why it isnt working - I do not know!!
Please help
Events
hello there. i read some articles about AsBroadcaster and EventDispatcher class, but...i did not get hte point.
for example i have class MenuItem, and class
ToolTip(there are many of the MenuItems and only one ToolTip) how can i create the Event for the ToolTip - "itemRolledOver"(for example) ?
PS i know that i can use onRollOver for the MenuItem class but i want to learn this stuff=)
thanks in advance
Help With Key Events
One thing I just can't seem to figure out no matter how much reading or testing are the key events, listeners, press, keyUP, keyDOWN. There are 40 different ways to do something with a keypress, and I'd like to learn some. I animated a little guy walking left, right, standing, jumping. I want to use the arrow keys to get him to go through these states. I need for when you hold down left for him to animate the walking left animation and when you let go to go back to standing or go to whatever animation is neccessary; determined by the keys. I've got some rigged way of doing it but it glitch's and looks bad. Could someone try explaining what a good way is to register key press, key down, key up so that I can use it? THANK YOU!
[F8]
Where Are The Events?
I am trying to build a little Object-Oriented video player (for files, not server).
I have set up:
- a NetConnection object with .connect(null);
- a NetStream object within the connection, and called .play(url);
- a Video object, to display the stream;
I have put handlers to handle:
- NetConnection NetStatus events;
- NetStream NetStatus events;
- NetStream onMetaData events (through a custom class as client);
- NetStream onPlayStatus event (through a custom class as client);
Well, playing around with commands, I figured that VERY FEW events actually get dispatched.
Basically, when calling .pause() or .close(), on the stream, no event is fired.
When the file reaches the end, I see the following events being fired, and the movie plays over again:
NetStream.Buffer.Empty;
NetStream.Buffer.Flush;
NetStream.Play.Stop;
NetStream.Seek.Notify;
NetStream.Buffer.Empty;
NetStream.Buffer.Full;
What the hell is going on????
Why don't I see ANY pause/play event?
Why don't I see ANY complete event?
Why!!??????
Why Should I Use Events?
Why should I use events?
I mean, in order to use events, I have to 1. setup an event dispatcher, 2.add an event listener to an object and 3. have a listener function set up.
Could I not achieve the same thing by just calling a function in whichever object I need to?
What is the benefit? Maybe I'm missing the point....
Anyone care to enlighten me? Cheers!
Why Use Events?
everything i read about events is how to use them, but i still don't know why you would want to. cant you just put in the onEnterFrame event:
PHP Code:
if (your event)
{
//your action
}
IE And Key Events
anybody notice that Internet Explorer (at least the new version) hijacks key down presses so that the entire page scrolls when you press key down or up?
this problem, as far as i can tell, is associated with wmode-- when this is set to 'opaque' there is definitely a speed gain--however, i've noticed an annoying habit of Internet Explorer's (Don't really use explorer much so don't know if this has always been the case or if just the most recent IE) --whenever I use IE to play a flash game with wmode='opaque', the up and down arrow keys scroll the entire web page! does anyone know a solution to this issue other than opening up a pop up window, which does work, but which is not ideal for me.
am i missing anything? is there a way to have wmode=opaque and not have this annoying scroll effect in IE?
AS3 Events
Can someone show how I can listen event dispatched from class in my main application ?
I'm using mooska's mysql AS3 library to get data but main application doesn't see when data is loaded in class file.
I tried dispatchEvent(new Event("gotData")) in class file when the data is stored into arraycollection.
Help With Events
Hi! This is my first time posting here. I am taking Flash 1 at the local college and even my instructor is stumped as to why I am having problems with this file. I hoped maybe some of you Gurus could help me with some ideas.
I have one FLA file. On the main timeline is 2 movie clips. One of the movie clips is in perfect working order and has no issues. The other is a simple movie clip with frame labels and a single button on it to load a GIF image. There are 12 frame labels on this movie clip, each showing a different picture at that frame and on each of those the button viewLarger has been placed and given an instance name of large1, large2, large3, etc. depending on what picture it is to load.
mediumMovie is the name of the movie clip that the buttons are in.
this.mediumMovie.large1.addEventListener(MouseEven t.CLICK, largePics);
this.mediumMovie.large2.addEventListener(MouseEven t.CLICK, largePics);
The button should be able to show that specific picture in an external window. But nothing I am doing is working.
function largePics(event:MouseEvent):void
{
var loadLargePic:URLRequest = new URLRequest(event.target.name + ".gif" );
navigateToURL(loadLargePic, "_blank");
}
All of this code is on the main timeline in an "actions" layer to keep all my actionscript in one place.
I added a trace into the function and apparently the button click is never even entering the function at all. Please remember that I am in this class and I have only known flash for a few months. I am far, far from knowing all the tricks and ins and outs of AS3. Any suggestions would be greatly appreciated though.
=) Thanks in advance! Pamela
As3 Events?
Quote:
ok i'm more of a as2 programmer. i understand how to code in as2 rather well.
recently i've been learning as3 and i've learned how to code all things without having to code on movieclips and declaring variables. and some of the statements i should be using but one thing i can't seem to do is the dam events.
see in as2 it was simple:
ActionScript Code:
this.onEnterFrame = function(){
// do code
}
but in as3 they changed it so i tried the code structure the help suggested but it didn't work. so i'm now all out of ideas. can anyone help?
this has been solved now. anyone looking for the solution, should read the article in the second post of the topic. then from there they can see my example in post 6 of the topic.
MC Events
hi everyone. I know that I can make an event for a button like this on the main timeline instead of the traditional way:
ActionScript Code:
_root.myButton.onPress = function() {
trace("this is my statement");
}
but how can you achieve the same thing for mc's. Specially for the data, and load events? Thank you.
Events Go Through The Mc
I have a mc with a white background drawn with beginFill and endFill. The mc is sometimes over another similar mc that contains a button. Now if click on the white backround the button beneath the mc gets the click.
How do I get rid of this?
I Tried to add a custom invisible hitarea but that didn't work.
1 Btn 2 Events In AS3
I'm trying to create a conditional statement where when I click a button it will go to one frame, play and then once the clip is triggered to stop it will go to another frame and play. I can figure out how to make a button go to one frame and play but I can't figure out how to actionscript 3 it to then go the next frame one this is completed. I basically want to create a site that will operate like this:
http://www.deutschinc.com/
I think I can handle the if construction to make the right clip leave the scene.
Please help!
Thanks
2 Events
im trying to get this thing to run two events at a time like this
onClipEvent(keyUp){
onClipEvent(enterFrame){
}
}
like that but with an action in the middle but it says theres an error in it.
does anyone know how to do that
Key Events Help
would you use a string to have AS recognise a whole word instead of the first letter of that word??
also once i have a MC appearing after a key has been pressed how do i allow the user to type in the input boxes without it disappearing again??
here is my code so far:
Code:
stop();
var oKeyListener:Object = new Object();
oKeyListener.onKeyDown = function():Void {
if (Key.getAscii() == login_txt.text.charCodeAt(0)) {
_root.login_screen._alpha = 100;
} else {
_root.login_screen._alpha = 0;
}
};
Key.addListener(oKeyListener);
that code is on the first frame.
but i also want the user to have the option of when they press any other key the window will disappear but if its open they have the option to type in it.
is this possible?
thanks peeps
Key Down Events
hi guys
i need to track the keyboard events in flash..right now if i press ctrl +shift + right arrow... i need some actions to take place .say trace("keyDown") .can some body pls guide.
Events.
Iv'e done events and things in my new classes just perfectly.
But wth is up with trying to do this in a frame?
I basically want to have some data initialized (before anything else) and uninitialized (after everything else), or rather how I used onLoad and onUnLoad (among others like mouseDown and mouseUp) for the main stage (or the frame I'm working on sort of thing).
Also, why on earth did these morons give us a constructor event without a deconstructor event? Imean fair enough if it is named differently, but why..... it makes no sense lol.
[AS3] Events
I whipped something up really quick and wanted to know if someone could help me. Right now I built a context menu class that just pulls its information from a XML file. That works fine and I also built a MainNav class that I have linked to a MC on my stage.
Everything works fine my question is since I have my MainNav class linked to the MC on the stage how can I access it from the Main class? Because I would eventually like to have it setup so that when you view the swf the preloader does it thing then the nav will tween in like it currently does. As of right now it tweens from the start but I would like to add a listener or something to that extent so that once the xml/preloader is done loading then to this.
FYI: In your class path you will have to have it like ../classes to work with my folder structure.
Thanks
1 Btn-different Events
Hi
Need some help with this:
PHP Code:
//Speed varsmin_speed = 1;max_speed = 6;beschleunigung = 1.03;speed = 1.6;//Clips posmc1._x = 0;mc2._x = mc1.width;mc3._x = 2*mc2.width;mc4._x = 3*mc1.width; //Changepointchange_point = -(2*mc1._width);//Bool varsvar drive:Boolean;var acceleration:Boolean;var deceleration:Boolean; //_______________________________________________________________________________//_______________________________________________________________________________//Deceleration and stopfunction anhalten() {speed = Math.max(speed, min_speed);this.onEnterFrame = function() {speed>min_speed ? speed /= beschleunigung : speed=min_speed=0;move_Clips();};}//_______________________________________________________________________________//_______________________________________________________________________________//Default drivefunction fahren() {this.onEnterFrame = function() {speed = 6;move_Clips();};}//_______________________________________________________________________________//_______________________________________________________________________________//Restart with acceleration function anfahren() {speed = Math.max(speed, min_speed);this.onEnterFrame = function() { speed<max_speed ? speed *= beschleunigung : speed=max_speed;move_Clips();};}//_______________________________________________________________________________//_______________________________________________________________________________//Clips loopfunction move_Clips() {for (var i = 1; i<=4; i++) {var myClips = this["mc"+i];myClips.filters=new Array(new flash.filters.BlurFilter(2,0,2))myClips._x -= speed;if (myClips._x<=change_point) {myClips._x += this._width;}}}//_______________________________________________________________________________//_______________________________________________________________________________//Btn eventsmy_btn.onRelease = function() {if () {trace(deceleration.valueOf());this.gotoAndStop(2);anhalten();test_Txt.text = "ANHALTEN";} else {trace(acceleration.valueOf());this.gotoAndStop(1);anfahren();test_Txt.text = "ANFAHREN";}};//_______________________________________________________________________________//_______________________________________________________________________________fahren();//default drive
What I want to achieve is that the btn can stop the default drive by starting the function anhalten and then it should be able to restart with the function anfahren...
I think this should go with if/else and bool-vars, but I could not make it work.
Thanks for any help.
Regarding The Events
Hi
i have created a clip with some animation. i hav a button. by clicking it the clip has to be removed. so i hav written it on release event of the button. but whts the problem is the clip has to be removed only when its full animation is over till that we hav to wait in on release event. is there any function to delay the event handler such that the animation gets over by some time and then it is removed from the screen.
awaiting for reply,
Thank you
Events
I have 3 buttons , each going calling a different movie clip.
Lets say for example, I have Movie clip 1 on the screen but I want move 2 to show
I click button 2 which calls movie clip 2 to zoom into the screen. but before movie clip 2 can zoom in, movie clip 1 needs to zoom out.
How do I set a condition to tell the active movieclip to finish before displaying the new move clip
Key Down Events
Hey guys, this is my first post here so... hi
Anyway... im currently making a side scrolling space game. Im completley stuck with trying to get the weapon to 'charge'.
I have the basic fire button on CONTROL, this works fine, but what i want is, if the CONTROL button is held down the weapon stops firing and charges, then releases a different fire graphic depending on how long the button is held down for.
here is the basic code i have to far
Spaceship movie clip:
onClipEvent(load){
_root.firea._visible=false;
fireCounter=1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL)) {
fireCounter++;
_root.firea.duplicateMovieClip( "firea"+fireCounter, fireCounter );
_root["firea"+fireCounter]._visible=true;
}
Regards
Scott.
MVC - Where Do Events Go?
I'm tackling AS3 for the first time and also trying to, at the same time, get a basic handle on the MVC pattern. I've never used a design pattern so I might be biting off more than I can chew : ( Anyways, I have this question:
My understanding of MVC is that:
Model: core logic and state are in this class; it's also the 'document class' typically?
View: graphical assets are rendered via this class
Controller: event handling
I am putting together a game as my first try at AS3 and MVC. Don't laugh, but it's a simple idea (I think) that my toddlers will enjoy. The game is called "Find Daddy!". The game will have a grid consisting of 5 rows of 5 images. Each image will be able to clicked on and, once clicked on, will be swapped with another image. The goal is basically for the player (my toddlers) to click on each picture and try to find the one that reveals a picture of me as fast as possible (I will add a timer and a 'score' will be generated at the end depending on how quickly they find me). Yes, it's dumb, but if you have/had/ever will have kids you might understand : ) Mainly though it gets me working on something real to learn AS3.
My game has 3 classes:
View.as
Model.as
Controller.as
The Model.as is my document class. I plan on putting all of the images and graphical assets in the fla's library eventually. For now, I am working out simple problems though, like buttons and event handling. I never did grasp this in AS2. In my View class I have:
Code:
private function createButtons():void
{
//new game button - make sure to add it to the library in IDE first!
newGameButton = new Button();
newGameButton.x = 50;
newGameButton.label = "New Game";
newGameButton.addEventListener(MouseEvent.CLICK, newGameHandler);
graphicsContainer.addChild(newGameButton);
}
private function newGameHandler(e:MouseEvent):void
{
trace("new game button clicked.");
}
When compiled and run the game displays a simple background 'game board' that I have in the fla's library, and adds this button to the display list. When I click on it, it works as expected by tracing out the "new game button clicked" text in the output panel.
But originally I tried putting the newGameButton.addEventListener and the newGameHandler() code in the Controller class. Am I misunderstanding the MVC pattern, or am I just not understanding how to do it syntactically? When I have the following code in my Controller class's constructor:
Code:
newGameButton.addEventListener(MouseEvent.CLICK, newGameHandler);
private function newGameHandler(e:MouseEvent):void
{
trace("new game button clicked.");
}
I get a compile-time error basically saying that I'm trying to access a newGameButton that it knows nothing about. Help!
AS3 Events
Hello everyone,
I'm learning AS3 now (no previous experience with AS). I've noticed at most of the examples out there that the sequencing of code lines in AS3 that makes little to no sense to me (compared to my knowledge in Java and other OO code with listeners). For example:
Code:
var myRequest:URLRequest = new URLRequest("large_image.jpg");
var myLoader:Loader = new Loader();
myLoader.load(myRequest);
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);
As you can see, if the sequence of execution is in the sequence of the lines, the load event starts before we add the listeners to it. Now lets say that the event itself is VERY short, we will lost the events right? In other languages you usually (not always) register the event before the action started.
Any thoughts?
I appreciate any comment and information on how Flash will execute the code if it is different then normal sequencing.
Thank you
Please Help Me With Events
Hello Everyone.
I am having some issues with a dropdown type of navigation that I developed in Flash. I recently posted about making a movieClip visible for only a certain amount of time, but I figured that might not be my best option.
Please bear with my explanation. I tried to make it as clear as possible.
I have 6 main navigation buttons. Two of those when rolled over invoke their own menu (which is a movieClip with buttons within the clip) to appear below the button. One of the two has a sub menu (again, a movieClip with buttons within the clip) for the menu.
Each of the main navigation buttons are just that, a button. When I mouse over the ones with the menu's appear because I put an event
Code:
menu._visible = true;
in the button. The same is done for the menu that has the sub menu. The buttons in the movieClip (the menu for the main button) has a the same type of call to the sub menu movieClip
Code:
submenu._visible = true;
Now that I have explained that, I'll describe my problem:
When I mouse off of the main navigation button, the menu movieClip disappears by my use of the
Code:
menu._visible = false;
This is great if I intend to go to another main navigation button, but bad if I want to roll onto my menu that appeared, because if I roll off of the main navigation button, the menu that I'm trying to rollOver disappears. The same happens with my sub menu.
I know this is a lot of explanation without the actual file, but if anyone has any advice I'm all ears!!!
Thanks
Brian
Two Of The Same OnClip Events?
okay, i'm a rookie. i got some code from different scripters to make these small movie clips move around in a 250x60 area. (WHICH IS by the way - not working). this may be a dumb question, but is it possible to have an 'onClipEvent (load)' with another one right next to it? The same goes for 'onClipEvent (enterFrame)'. Do these have to be combined?
i've got a headache.
---------------------------
onClipEvent (load) {
stop_me = false;
_x = Math.random()*250;
_y = Math.random()*60;
xspeed = 2*(1-2*Math.round(Math.random()));
xspeed = 2 or -2;
yspeed = (1-2*Math.round(Math.random()));
// yspeed = 1 or -1
}
onClipEvent (load) {
my_name = _name.substring(2, _name.length-1);
// get the number of the MC, 1 if it's MC1, etc...
total = 8;
// assuming there are 8 MC's floating around, MC1 up to MC8
function testHit () {
turnre = false;
// set turnre to false : no hits
for (i=1; i<=total; i++) {
if (hitTest(_root["MC"+i])) {
turnre = true;
// it's hit another MC
break;
// break out of loop since there's a hit
}
}
return turnre;
}
}
onClipEvent (enterFrame) {
if (testHit()) {
xspeed *= -1;
// turn direction around
yspeed *= -1;
}
}
onClipEvent (enterFrame) {
if (!stop_me) {
_me_x += xspeed;
_y += yspeed;
if (_x>=0) {
_x = 0;
xspeed *= -1;
} else if (_x<=250) {
_x = 250;
xspeed *= -1;
}
if (_y>=0) {
_y = 0;
yspeed *= -1;
} else if (_y<=60) {
_y = 60;
yspeed *= -1;
}
}
}
On Mouse Events
I want to perform an action (in this case, rotate the movie clip) that will only take effect when both onmouseover and press keyboard key are true. So far, when I set it up, the action happens when _either_ event is true.
Any thoughts? Thanks.
On Key Events -- Probably Stupid ?, But Please Help
I made a keypad for people to answer questions in a survey. I wanted to allow people to either use their mouse or the keyboard. For some reason I have been able to get the on Key event to work for every number but for the "enter" and "delete" keys.
I am using the syntax straight from flash normal mode.
on (keyPress "<enter>") {
//here would be my action script
}
on (keyPress "<delete>") {
//here would be my action script
}
anyone have any idea why I cannot get these 2 to work???
HomeMade Events
I am starting this thread because I am thinking along a certain line of thought, and am curious to see who's Flash intellect I tickle
What is an Event?
An Even is:
- discreet/unique condition
- trappable
- upredictable
- occurs iregardless of a handler.
It is discreet or unique implies that their is
no ambiguity in the nature of the event. A MouseDown,
for instance, cannot be confused with a MouseUp.
An event being trappable does not imply that the user
waits to "catch the event in the act", but rather,
the event calls a handler routine to execute
specific code when the event occurs.
An event's occurance means that a certain condition
(or program state) has been satisfied and that the number
of possible reasons for this event to have occured is
mathematically infeasable to compute. For example, we
wouldn't write a routine that checks to see if the mouse is
in 1 of 480000 points on the screen now would we?
The fact that an event occurs irregardless of an
event handler is a logistical truth. It is like stating
that yes the tree does make a sound when it falls in the
forest, but... who cares?
HomeMade Events?
Is it possible to create Homemade events and when they
occur, call it's handler?
Well that is the subject open to debate. I believe it is
possible, given the proper application of logic.
Button Events
Hello,
I have two Buttons and they overlap itself! That means: A large button and a small button is completely in the large Button situated.
At both buttons I have the “on events” rollOver and rollOut included.
Problem: If I drive with the mouse into the large button, I get the rollOver event, if I drive now with the mouse on the small button I get the rollOver event from the small button, but I get beforehand the rollOut event from the large button!
But I do not want to get that yet, since I am still in the surface of the large button!
Known somebody, who I can prevent the rollOut event from the large button????
Thanks
Greet
David
2 Simultaneous Key-events?
can flash handle 2 simultaneous key-events?
i tried it in flash mx with two dummy clips that handle the events, but the commands i trigger are executed only one at a time
code of clip 1:
onClipEvent(keyDown) {
if (Key.getCode() == Key.RIGHT) {
val = _parent.obj1._width + 10;
_parent.obj1._width = val;
;
} else if (Key.getCode() == Key.LEFT){
val = _parent.obj1._width - 10;
_parent.obj1._width = val;
;
}
}
code of clip 2:
onClipEvent(keyDown) {
if (Key.getCode() == Key.UP){
val = _parent.obj1._height + 10;
_parent.obj1._height = val;
;
} else if (Key.getCode() == Key.DOWN){
val = _parent.obj1._height - 10;
_parent.obj1._height = val;
;
}
}
now if i hold e.g. UP and LEFT the resize in this example works, but only for one key not for both...
thank you for your help!
Timed Events
I have searched everywhere in the literature but to no avail.
I want to do two things: Have a line of type appear for 'x' seconds and then pass to the next piece of type (Like an automated PowerPoint presentation); and I have a voice track running with bulleted type points appearing in sync with the voice. I wish to avoid mile long time lines. Is there a way to tell the bullets to appear according to time?
Thanks for your time and attention.
Catching Events
I'm trying to catch an event that will be called each time the page my FLASH applet is on will be refreshed.
Here is the code I use so far :
-------------------------------------------------
onClipEvent (load) {
loadVariables ("CarteContenu.asp", this);
}
onClipEvent (data) {
gotoAndPlay (2);
}
onClipEvent (enterFrame) {
this.bullet.duplicateMovieClip("bullet2", 100);
this.bullet2._x = this.AdresseX2;
this.bullet2._y = this.AdresseY2;
}
--------------------------------------------------
I would like to find something else than "load" to put my loadvariables call in it. This code works but I must close my browser and restart it to see the changes.
What event should I catch so loadvariables is called each time the browsert refresh the page?
Mouse Events
I have a button and when the mouse clicks it, I want the movie to go to a different spot on the timeline. But I don't know which actions to give it. The "on" option under Movie Control is greyed out. What am I doing wrong?
Thanks
Button Events
Hi,
I'm as new to flash as it gets... I'm having trouble finding info on how to assign actions to a button. I want to have a scrollpane show up on the same stage when i click a button. The best I found so far is how to assign a link to a button!!! I know this should be an easy thing to do... what can i say...
Any help is greatly appreciated.
Clip Events
I have a small tile based game that I dynamically place clips (ducks) onto that I'm having a couple of problems with. The duck movie clip has several actions: up, down, left, right, dive, swim, and surface. The first problem that I'm attempting to do, with absolutely no success, is create roll-overs and mousedown actions for these intances.
I've create an invisible (just the hit area) button and placed it on the ducks. What I want to happen is when one rolls over a duck, a pop-up clip pops up with a text message in the box. I've created this movie clip and named it callout with a dynamic text in it to display different text.
When someone clicks on a duck, I want a new message to appear and the duck to stop, a course of where the duck is headed to (using some vector addition that I've done), dive, swim, and then surface at the point on the where the triangle is (again, just the current position and the resulting x,y coords from the vector addition). The tricky part is that only after the duck has arrived at the destination can one click on it to remove the duck. To deal with this, I created a new invisible button that is on the surface part of my duck clip.
Can someone please help???
One Time Events
Hi,
I'm currently using a progress bar to indicate how much of my movie is loaded. When I reach a certain percentage loaded, I want the movie to start automatically, so I have an "if" statement that starts the movie playing when the percentage loaded is greater than 10%.
Everything works fine on this. However, I also have a Pause button for my movie that allows the user to stop the movie. So what's happening is that until my movie completes loading, it continues to loop through the "if" statement. Each time telling my movie to start playing. Because of this, the Pause feature will not work while the movie is loading, because as soon as the user hits Pause, then the if statement executes and tells it to start playing again.
What I really need is a "when" statement, something that executes the script the first time the condition occurs and doesn't do it anymore after that. Is there such a thing? Or what's an easy way to do it. Below is one frame of the preloader (note there are other frames not shown).
Thanks,
Maria
iBytesTotal = _root.CurrentSection.getBytesTotal();
iBytesLoaded = _root.CurrentSection.getBytesLoaded();
iBytes = Math.round((iBytesLoaded/iBytesTotal)*100);
if (iBytes>10) {
//This automatically starts playing the movie when 10% is loaded.
clearInterval(_global.SloMointervalID);
_root.SectionControls.gotoAndStop("Playing");
tellTarget ("_root.CurrentSection") {
play();
CurrentPara.Play();
}
_root.SloMoControl.gotoAndStop("Playing");
}
setProperty("pBar", _xscale, iBytes);
sStatus=iBytes add "% Loaded";
Conflicting Events
OK here's the problem...
I have an interactive map application which has the image of the area on in an MC called _root.map. On this mc is onPress code to zoom in/out,etc...
Now I have a list to the side that lets the user turn different layers of info(hotels, parks, dining, etc.) on and off. This info is represented by dots that are dynamically attached to an empty movie clip inside map MC...so the path would be _root.map.emptyclip.dot.
So the problem arises when i try to add onPress functionality to this dot (to display a name,image, etc).
When I test the movie, the dot's onPress functions are ignored in favor of the map's onPress events..
Is thre any way to give the dot's onPress event precedence without moving the dots to the main timeline(since they have to move/zoom with the map)?? Should I be using swapDepths??
Thanks for any help.
Time Events
I want a script to be executed every second..
ex.
Duplicatemovieclip every 1 second.
How do I do?
AS2 Class Events
hmm... I know this is kind of dump.... but I don't really understand what the Macromedia Help file is talking about......
I created a class that extends MovieClip. Basically, what it does is it attaches a textField on stage and do something with the text.
Now, my question is, how can I get this class to response to events such as onMouseOver, onMouseDown and onPress??
Thanks a lot!!!!
Events On Images
Hello everyone,
May You help me? I'm new in flash, but i need fast to understand some things.
I have written action script which is loading and scrolling external images. (http://rafes.ktu.lt/~mairo/flash/ )
But I don't know how to do if I rollover on image, it should change color (maybe become black/white or _alpha parameter is changed (it's not very important).
On image release, should change text.
now my script is:
_root.createTextField("textas",10,3,0,100,50);
_global.textas.text="";
_global.pav_sk = 8; // how many images
_global.parastes = 10; //space between images
_global.plotis = 150; //image width
_global.aukstis = 120; //image hight
_global.prad_x = 0; //x coordinate of image
_global.prad_y =0; //y coordinate of image
_root.onLoad = _global.funkcija = function() {
textas.text="kint:"+prad_x;
_root.createEmptyMovieClip("main", 0);
main._x = prad_x;
main._y = prad_y;
for (cont=1; cont<=pav_sk; cont++) {
_root.main.createEmptyMovieClip("immagine"+cont, cont);
with (_root.main["immagine"+cont]) {
loadMovie("img"+cont+".jpg");
_x = (plotis+parastes)*(cont-1);
_y = aukstis/3;
///**************************************
//*******THIS IS NOT WORKING******
onRelease =function() {
textas.text="paspausta:"+count;
}
//*****************************************
}
}
};
i hope you understood whats the problem..
if it's not clear, i have uploaded fla. http://rafes.ktu.lt/~mairo/flash/test3.fla
Thanks in advance for Your help.
|