Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




[F8]end Of Sound Triggers Url Launch?



I have an animation set to 40fps but as you will know some computers wont reach that.

The problem is on my computer it does and I have a music file being played on the intro. On here I have it set so that when the animation stops it will forward to an address but on old computers it will play the audio but have a big gap until the animation has finished.

Is there anyway with actionscript to find out when the loaded audio has finished playing and then go to a URL?

I'm sure there is but I just don't know it.

Also I have a button that I need to fade after 10 seconds. Is there anyway that I can constantly update a variable of the current progress of the audio file so that when the audio file reaches 10 seconds it will fade the button?

Thanks to anyone who can help me with this



FlashKit > Flash Help > Flash ActionScript
Posted on: 09-23-2007, 11:32 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

If The Microphone Picks Up A Sound Over A Certain Level, Then It Triggers A New Piece
hello,

I was wondering if you can help me! Basically I am working with video in flash for an installation. What I am trying to do is have one long continuous film that plays, but if the microphone picks up a sound over a certain level, then it triggers a new piece of film.

so for example, the film is on my standing on the street, when a viewer shouts into the mic i was for it to activate a new piece of film showing me running away.

Do you know if this is possible? If so could you possibly point me into the right direction. I will me REALLY grateful!

Many thanks,

Ellie

Triggers/buttons
Hey guys

Was wondering if there was a way I could have a button that was active but when u hover over it you dont dont get the active button cursor, it just stays the same.
An example of what i want is here:
http://www.thevines.com/news.aspx
Things are triggered by hovering over objects but the cursor stays the same.

Any ideas?
Attached is also a part of my site.

Thanks

Movieclips As Triggers
OK I try my best to explain this. I have this movieclip (instance name "t1") i use as a trigger when a car (i_car) hits it. Inside it there is 2 frames. The idea is to get the car going under the bridge when trigged and normally the state is that the car goes above the bridge.

Frame 1:
if (_root.t2.hitTest(_root.i_car)) {
_root.i_bridge.swapDepths(200);
_root.t2._yscale = 300;
_root.track.i_collision.gotoAndStop(3);
} else {
_root.i_car.swapDepths(200);
_root.t2._yscale = 100;
_root.track.i_collision.gotoAndStop(2);
}
Frame 2:
gotoAndPlay(1);

I use this trigger at the end of the bridge. (the road going under it). Problem is when ever i put another similiar trigger movieclip, this new trigger doesn't work. I just can't find the reason why it wont work.
This first trigger works fine.

Time Laps Triggers
Is there a way to trigger a Target/movieclip based on the user takin too much time?

example: 30 seconds without the user choosing anything
a warning shows up or a demo would play similar to a video game??

Thanks

Button That Triggers Animation.....
ok, i've been racking my brain for 3 days trying to figure out flash 5. i have been through all the tutorials, and i still have no idea how to do what i want.

i am trying to create a button that when clicked will triger an animation that runs once.

of coarse, i'm using simple items right now, until i figure out how to do it right. for example, i just have a big ole button in the middle of the stage, that chagnes colors when moused over and clicked, and an arrow that goes from left to right.

what i want to do is to just look at the button and when i click it, the arrow goes across the screen once.

i have tried everything that i can think of, but its just not working. everytime test the movie, it shows the button, but the arrow is nonstop flying across the screen.

the closest i got was that when i push the button, it restarts the animation, but it still keeps going.

i know that i'm new, and this is probably something really simple,but i have looked all over the place and just can't find anything.

please help

Mouse-over Re-triggers Movie
Hello,
i have a pop-out menu and i'm trying to figure out how to keep a movie (within my main movie) from re-starting when someone mouses-over a new button.

Here's the actual menu - http://www.layaboutband.com

if you mouse over it, it opens, but if your mouse stays stationary, it starts to close. the reason, as i see it, is that the menu names (music, photos, etc) are the buttons, and the brown background is not.

basically, i want it to open and stay open as long as the mouse is there, and the whole thing close when you mouse-off of the menu.

maybe i dont have this setup right, i'm new to it all.

attached is the FLA, and here's a zipped up copy of the FLA if that helps:
http://www.layaboutband.com/menu.zip



thanks a lot for any help

[F8] Cordinate Triggers Event
In AS2 , I have a MC that moves across the stage. When it reaches a certain cordinates I need it to load an external swf . I usually load externals swfs via button event but now I need it to load when it reaches a certain position on the stage . Any help would be cool ....Thanks

DL

Animation Sequence With Triggers
I have an animation sequence that moves an mc to 4 different points points on the stage. The the idea is to have the mc pause at each point allowing for a text bubble to pop up giving the user enough time to read them. The bubble then goes away and the clip moves to the next point. (The bubbles are in place at all times with alpha set to zero).

The desired effect is to have the bubble pop up just before the mc reaches it's designated location allowing time for the bubble to fade in. The bubble's alpha property is set to zero once the mc moves on to it's new location.

Thanks / help appreciated

Key Press Triggers On(release)
This is a strange one. I have a mouse listener and a key listener. The mouse listener listens for mouseDown and mouseUp and the key listener listens for keyDown and keyUp.

The problem is, if a user clicks the mouse (so mouse is currently down) and then presses a key the mouseUp function fires.

The same thing happens if you put the code on a movieclip and use on(press) etc for the mouse and onClipEvent(keyDown) etc for the keyboard.

Anyone had this before and know how to resolve it?

FLASH BUTTON Triggers URL
Hello... I want to be able to click a FLASH button I created, that when clicked goes to my . How can I do this? I'm having trouble figuring it out. Also I need a 5-second delay before the designated URL page opens in order to let the sound ring out that I've assigned to the button.
Please help. I'm a novice to FLASH.

Race

Buttons As Clip Triggers
Ok...i' am yet to find an elegant solution to this problem, i wonder if anybody knows...

let's say that i have 3 buttons in a menu and 3 clips(i say 3 to explain the scenario, i want it to work with n buttons and n clips).

each clip has a timeline-based animation going from frame 1 to frame 20.

if i click on button one i want clip one to start the animation and stop at frame 20.

then if i click on clip 2 i want first clip 1 to play the animation reversed (20 ->1) and only AFTER to play clip2 from frame 1 to 20.

now if i click on button 3 i want clip 2 o play the animation reversed (20 ->1) and only AFTER to play clip3 from frame 1 to 20.

of course this has to happen with any button clicked in any order: if there is a clip with the animation at frame 20 then play it in reverse and then start the related clip animation.

I managed to do it with 2 buttons and clips but already adding the 3rd one gets tricky...i am struggling to write the code properly...i'm sure i am just overlooking something..

cheers for advice...

D

Timer Triggers Event
Yes, I have posted this topic but its really urgent that I find a solution.

When the countdown timer reaches :30 i need a warning to display and/or sound.

ADDthis line of code:


Quote:




if (outputSec == 30) { warning.text="Warning" }




the code is below


Code:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;

}else if (outputSec == 0) {
outputSec = "00";
}
}
}

chk=0;
stop();

Animation Sequence With Triggers
I have an animation sequence that moves an mc to 4 different points points on the stage. The the idea is to have the mc pause at each point allowing for a text bubble to pop up giving the user enough time to read them. The bubble then goes away and the clip moves to the next point. (The bubbles are in place at all times with alpha set to zero).

The desired effect is to have the bubble pop up just before the mc reaches it's designated location allowing time for the bubble to fade in. The bubble's alpha property is set to zero once the mc moves on to it's new location.

(This question had to have been asked about a million times. If anyone can point me to a tutorial that that covers this I would appreciate it).

Thanks / help appreciated

FLASH BUTTON Triggers URL
Hello... I want to be able to click a FLASH button I created, that when clicked goes to my . How can I do this? I'm having trouble figuring it out. Also I need a 5-second delay before the designated URL page opens in order to let the sound ring out that I've assigned to the button.
Please help. I'm a novice to FLASH.

Race

Hover Triggers Movie
Hi all,

I would like to create a menu where when a link is hovered over a movie, in another section of the menu, will play a short clip (loop).

I'm very new to Flash 8 Pro - could someone suggest a tutorial for this?

Thanks
Bitdaf

Where To Begin With Button Triggers
I have a navigation interface designed in flash, and would like to have the buttons and other interface elements move and change and transition into the next page on click.  I understand all the principle in getting a movie made and such, but how do I make my once static page move?  Do I make another swf? Scene?

I really only need a push or a general idea. I think once I know the direction to think I'll be able to do it.

Button Triggers Loop?
Code:
on (press) {
x = events._x;
for (p=0; p<(math.abs(x+300)); p++) {
if (x<300) {
setProperty("events", _x, x+10);
} else if (x>300) {
setProperty("events", _x, x-10);
} else {
setProperty("events", _x, x);
}
}
}
It's supposed to loop enough times to move the MC to the specified position from where it was. Right if it is left of there and vice versa

[F8] Countdown Timer Triggers And Event...possible?
Hi,

I have a timer counting down.

When it hits :30 I need a warning sound and message.

Not sure how to do this. I thought some kind of listener

Below is the code

Thanks


Code:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;

}else if (outputSec == 0) {
outputSec = "00";
gotoAndPlay(3);
}
}
}

chk=0;
stop();

GetURL Triggers Popup Blocker?
Why are user initiated actions triggering popup blockers?!


Code:
my_button.onRelease = function(): Void {
getURL("http://www.macromedia.com", "_blank", "POST");
}
should not trigger a popup blocker!

Anybody know of any workarounds? What I really need to be able to use is:

Code:
my_button.onRelease = function(): Void {
LoadVars.send("https://www.paypal.com/cgi-bin/webscr", "_blank", "POST");
}
but getting the GetURL to work is a start... I've tried changing "_blank" to a named window and "_self", neither work. I've also tried using an onMouseEvent listener to open the new window and that triggers the popup blocker too.

Thanks.

BUG: Pressing A Key Triggers Onrelease - Is There A Workaround?
Hi,

This is a very annoying bug in ActionScript, which seems not to be very much known.

Consider the following trivial code:


Code:
s.onPress=function(){
trace("onPress");
}
s.onRelease=function(){
trace("onRelease");
}
where "s" is a movie clip.
If you press the mouse button on s and do not release it, so as to trigger the onPress, then, when you press any key, the onRelease is triggered!!

That is, pressing a key (even without having any listener for it at all) triggers the onRelease of a clip which had been "onPressed" if the mouse button hasn't been released yet.

Now my question is: does anyone know some workaround?

I need to drag movieclips, and I need to do things when a key is pressed WHILE dragging a movieclip. So I use startDrag inside the movieclips' onPress, and stopDrag inside the movieclips onRelease; but my problem is that when I press a key while dragging a movieclip, its onRelease will be triggered (without reason) so it will stop dragging (and run all the onRelease stuff)....

Note that the use of startdrag and stopdrag is an example of what I am doing, but is not necessary to reproduce the bug.

Thanks in advance
Matteo

Countdown Timer Triggers And Event...possible?
Hi,
I need some help with this timer. I need it to display a warning when it hits :30 . Any ideas would be great.

Also, there is more code for the timer but this is the bulk

thanks





Code:
function countDown() {
if (Math.round(outputMin)==0 && Math.round(outputSec)==0 || chk==1){
clearInterval(timer);
}else {
if (outputSec != "00") {
outputSec = Math.round(outputSec) - 1;
//trace(output);
}else {
outputSec = 59;
outputMin = Math.round(outputMin) -1;
}
if (outputSec <= 9 && outputSec > 0) {
outputSec ="0" + outputSec;

}else if (outputSec == 0) {
outputSec = "00";

}
}
}

chk=0;
stop();

Cue Point Triggers Early When Buffering FLV
Hi everyone,

I'm doing a full flash video site, and have got all the video edited etc, but am at the stage where I am implementing it all into Flash and have run into a pretty big problem at the early stage of this part.

I'm using the netStream class for video playback, (although I've also tried it with the FLVPlayback component with the same problem), and if I use "ns.setBufferTime(10);", the cue point I have in the video hits way too early.
You can see what I mean here:

http://www.flash.uk.net/qualitytesti..._Holder-3.html

The cue point is set to trigger the contact details window just as she points to the right, but with the buffer set to 10 secs, it triggers at the start of the video.

Can anyone help me understand why this is happening and what I can do about it? I've been up for 2 long days trying to find an answer but haven't ben able to yet.


Another thing, is that I'd like the site to load the individual FLV's in the sequence that I choose, so the most important clips would load first. How could I tell Flash which video's I want loaded in a particular order - would that involve an array? If so, can anyone give me some advice as to the code to load a sequence of FLV's sequentially?


Thanks a lot in advance,
Olly.

Triggers After Drag / Drop Objects
hi
i'm making a simple "game" where shapes are put into category boxes,
after all the shapes are put into place i want a box to pop up, i have the attached code:

(you can ignore the "2_1_" this is just my referencing...)

where would i place this code? the whole thing is on one frame

Thanks

Tom









Attach Code

if(((2_1_square._x= 530.6) and (2_1_square._y= 138.6)) and
((2_1_trapezium._x= 474.6) and (2_1_trapezium._y= 413.4)) and
((2_1_isoceles._x= 289.8) and (2_1_isoceles._y= 455.0)) and
((2_1_rightangle._x= 178.4) and (2_1_rightangle._y= 365.0)) and
((2_1_equilateral._x= 198.8) and (2_1_equilateral._y= 156.8)) and
((2_1_parallel._x= 406.2) and (2_1_parallel._y= 158.6)) and
((2_1_rectangle._x= 431.5) and (2_1_rectangle._y= 246.1)))
{
2_1_welldone._visible = true;
}else{
2_1_welldone._visible = false;
}

Flash Button That Triggers Dynamic Url
I am not an advanced html coder but I think this should be feasible...

I am setting up a php page that creates dynamic url links within the html code. The links aren't always the same. I want to have my FLASH content contain buttons that trigger the browser to go to the specified url that are dynamically created. How do I go about this?

Is there a way FLASH can have the a button, that when is clicked, triggers a variable that I have referenced to a dynamic url and goes there?

I look forward to your help.

-Trode

Drag And Drop Triggers New Scene
I'm looking for a tutorial that will help me create a flash movie that allows the user to drag one movie symbol onto another that will trigger the movie to start a new scene. There will be 4 choices for the user hence I need to set up some action script that will decipher the difference between the 4 choices and send the movie to three alternate scenes depending upon the symbol that has been dropped on.

If someone could point me to a tutorial on this (I can't seem to find what I need at Flashkit), or if you know what action script I need I will be your new best bud!

Thanks in advance,

michael

Losing Focus Triggers GotoandPlay?
Hi Guys,

I have an input text field (not a component) inside of a movieclip. I was wondering if there was a way where when the text field loses focus (ie. when I click outside of a field, not when I tab or click into another field) if I could trigger a gotoandplay function in the movieclip. I have tried several methods and have been close, but unsuccessful. Thanks for your help!

[Flash8] Mouse Triggers Animation
Hello gurus, (or is it guri?)

Basically I want to have something pop-up, and stay up on when the mouse moves to a side of the swf, but it re-animates the pop-up motion when the mouse is moved even after it is on one side. Here is the script I wrote for it: (left_motion is the mc that has the animation.)

onMouseMove = function() {
if (_xmouse <= 300) {
left_motion.gotoAndPlay("up");
trace("mouse is on the left");
}
if (_xmouse >= 301) {
left_motion.gotoAndPlay("down");
trace("mouse is on the right");
}
};

So what I'm wondering is, how do I have the pop-up animation happen only when the mouse has changed from the right to the left, and vice versa (sides determined by the x position of the mouse). I know there must be a way. I appreciate your help!

Thanks,
trippel

Movieclip Event That Triggers When Size Changes
Is there a movieclip event Im not aware of, which triggers once the width/height of the movieclip changes? By that I mean the contents of the movieclip...

so whenever it's rendered, it fires this event.

Thanks!

Flash Button That Triggers Dynamic Url
I am not an advanced html coder but I think this should be feasible...

I am setting up a php page that creates dynamic url links within the html code. The links aren't always the same. I want to have my FLASH content contain buttons that trigger the browser to go to the specified url that are dynamically created. How do I go about this?

Is there a way FLASH can have the a button, that when is clicked, triggers a variable that I have referenced to a dynamic url and goes there?

I look forward to your help.

-Trode

Mouse-over Triggers A FLASH Animation
Hi... I want to mouse-over an image in DREAMWEAVER and trigger a FLASH animation in another area of the page. How can I do this? THANKS!

One Movie Clip Ends, Triggers The Next One Begins HOW IS IT DONE?
OK so I have 2 movieclips. After one finishes, I want it to begin playing the second. How is this done? How do you make it so that the ending of the 1st MC triggers the 2nd MC to start?

Actionscript Calculation Triggers Timeline Change
Can someone help me code a basic division calculation?

Basically:

"input text field 1"
divided by
"input text field 2"
then a button that when clicked calculates the percentage and places into a dynamic text field.

Once I get that then my next step would be to somehow make it so that percentage answer causes a movieclip to move somewhere on the timeline.

Any ideas?

Is There An Event That Triggers When A MovieClip Leaves The Stage?
Is there an event or can you create a listener for when a movie clip or other object leaves the stage?

The problem I have is with Components or classes that are used within a movie that uses the timeline. Say you have a class that appears at a frame on the timeline and the timeline is sent another frame. It is useful to have classes /components clean up after themselves. An event for this would make the job easy.

Input Textfield Triggers Sandbox Violation (AS2)
I have this weird phenomenon that I've seen other people write about, but I haven't found any useful replies...

I have a flash content editor that accesses php files on a server, jpeg files on that server, upload jpeg files to that server and that's it. It all works fine, I have numerous input textfields and access numerous php files.. I test it running from the flash editor and it's all swell except.. on one particular set of input fields any time I type anything I get

*** Security Sandbox Violation ***
SecurityDomain 'http://www.bla bla bla/login.php' tried to access incompatible context 'file:///bla bla bla /editor.swf'

which is by the way not true.. that php file is accessed once at the beginning and there's no way that bit of code could be run again as I remove the mc containing it and also delete the function for good measure.

if I skip loading that php it complains about any other php that is loaded first..

Everything continues to run fine, even copy paste (someone somewhere suggested that it might actually be related to the local sandbox and that it shouldn't let you do anything local, like copy paste), so it doesn't seem to actually block anything..

but what weirds me out the most is why this only happens to certain input fields and not others (all are dynamically generated)

Any ideas anyone?






























Edited: 10/22/2007 at 05:51:44 AM by cicnats

Script Get Time Triggers Load Movie
I'm trying to build a script that checks the time on the computer,
then it will load one of several external movies at a certain time.

At 3pm loadmovie

At 9pm loadmovie

[FCS3] OnRollover Movie Clip Triggers Only Once
Hello,
I am getting an unexpected behaviour when using the onRollOver event with a movieclip.
The onRollOver behaviour is initialised after some animation. This allows me to hold my cursor over the movieclip. When the initialise function adds the onRollOver event function to the clip, it triggers, even though my cursor is already over the clip and a nice animated glow is added to the movieclip. This is good and the behaviour I want.

onRelease the movieclip I call a disable function and this sets the onRollOver event function to null. After some more devestatingly good animation, I reuse the initialise function to reset the onRollOver event function to react again. This time, if my cursor is already over the clip when the onRollOver is initialised, the onRollOver does not fire.

I'm guessing this has something to do with a function already being attributed to the onRollOver behaviour but I have reached (oh so quickly) the limit of my AS knowledge. Can someone please tell me why this is happening and if there is anything I can do about it?

Hopefull this code snippet is clearer than that description:


Code:

function wsInitNodes():Void{
wsCurrentNode.onRollOver = function(){
// Do groovy animation stuff
};
wsCurrentNode.onRelease = function(){
wsDisableNodes();
};
}

function wsDisableNodes():Void{
wsCurrentNode.onRollOver = null;
wsCurrentNode.onRelease = null;
}

// animation
// cursor over clip
// wsInitNodes();
// onRollOver fires
// wsDisableNodes();
// Do some other stuff
// cursor over clip
// wsInitNodes();
// onRollOver does not fire
// Stuck, any help would be great, thanks.

MouseOver Button Triggers Image Change
Hello all,
My appologies if this question has already been answered if so i must have missed it.

My question is easier to explain by pointing here...

http://www.htmlgoodies.com/beyond/dualflip.html

The thing is the example above is in javascript and i would like to do the same thing in Flash.

Roll the mouse over a button and an image on the stage changes, then being a roll over the "image" natually flips back onMouseout.

i'm thinkin' typ

shownew == image1

on(mousover)
    {
      shownew(image2);
    }
stop()

on(mousout)
    {
      shownew(image1);
    }
stop()

on(press)
    do what ever.


Hope this makes sense and please ask for more info if needed, or if possible a tutorial some where. 'cos this would really help me.

Thanks for your time, reading this  and even more thanks if you can help me.
Ramsey

-------------------------------------
Laughing out loud every day,
keeps the doctor away....gotoAndPlay
-------------------------------------

WARN: Skype, IE Triggers Memory Leak In Flash
A warning to all:

Having Skype installed triggers *huge* memory leaks in Internet Explorer 7 on Windows (possibly other versions) if the webpage you are viewing uses Ajax/DOM commands to load/unload Flash/Flex content that use ExternalInterface commands.

At this writing the only known fix is to tell your users to disable Skype.

Some testers have reported improved results by upgrading Skype to 3.8.0.154 (released August 14th, 2008) or later, although the memory leak seems to persist to some degree.

The core problem (we think) is a bug in IE: If any javascript var has a reference to a Flash/Flex app, and that app is removed from the page using Ajax-style DOM commands (innerHTML, removeChild, etc.), the javascript reference to the app remains, preventing garbage collection and triggering a memory leak. The SWF will then remain in memory, even on a full page refresh.

Traditionally, the solution (as used by SWFObject 2.1, which first solved the IE bug) is to destroy all scripts and functions within the object/embed that displays the flash/flex app, prior to physically removing the element:


ActionScript Code:
function removeObjectInIE(id) {
    var obj = getElementById(id);
    if (obj) {
      for (var i in obj) {
          if (typeof obj[i] == "function") {
            obj[i] = null;
          }
      }
      obj.parentNode.removeChild(obj);
    }
}

This effectively kills any reference that ExternalInterfaces may have created, allowing a removed flash app to garbage-collect.

This solution does not appear to work for Skype, however, which injects about a dozen javascript functions and variables into every page you visit. Several of these javascripts contain references to various page objects. Since these references exist outside of the Flash/Flex element, they are not cleaned by traditional cleaner functions and thus trigger the memory leak.

Verified in Skype 3.8.0.134. Appears to be at least partially fixed in the August 14th, 2008 release of Skype (3.8.0.154) and in the beta for Skype 4.0, but we're still looking into it.

The bigger question is WHY is Skype making a javascript reference to every Flash app on every page I visit? Sounds a little bit like spyware to me...

Dynamic HTML Text... Hyperlink Triggers Function?
I have a flash movie with a dynamic loading textfield formatted in html. What I'm looking to do is format (using a tag?) the loaded html code to have a hyperlink (<a href?>) gotoAndPlay(2) or perform other functions. Anyone familiar with how to go about this?

Thanks
-Mike

Dynamic HTML Text... Hyperlink Triggers Function?
I have a flash movie with a dynamic loading textfield formatted in html. What I'm looking to do is format (using a tag?) the loaded html code to have a hyperlink (<a href?>) gotoAndPlay(2) or perform other functions. Anyone familiar with how to go about this?

Thanks
-Mike

Clicking On Sprite Child Triggers Its Parent's Function As Well.
Hello.

I have this menu item, which is a Sprite. The menu item then has several other items, also Sprite, as children. All items have a listener for click events. When I click the parent item, it's all ok, but when I click one of the children, both the child and the parent Sprite's event handler functions are triggered.

CODEvar myParent:Sprite = new Sprite();
var myChild1:Sprite = new Sprite();
myParent.addChild(myChild1);

function click_parent ($event:MouseEvent) {
trace ("parent clicked");
}
function click_child ($event:MouseEvent) {
trace ("child clicked");
}
myParent.addEventListener(MouseEvent.CLICK, click_parent);
myChild.addEventListener(MouseEvent.CLICK, click_child);

//(Clicking myParent)
//parent clicked

//(Clicking myChild1)
//child clicked
//parent clicked

Create A Perimeter Around An Object That Detects The Mouse And Triggers An Effect
I have my main movie called "base.fla". On "base" I have my logo at the upper right corner. It was a graphic symbol, I converted it to a movie clip called "tri".

What I want to happen is when the mouse pointer enters the perimeter of "tri" I want the _alpha action to take affect. The closer the mouse is to "tri" the lower the percentage of _alpha there will be on "tri". Kind of like a motion sensor. If the mouse pointer is X amount of distance from "tri", then "tri" will be X amount _alpha (higher or lower percentage) depending on the mouse's distance from "tri".

Say the mouse pointer is 200pt from "tri", then "tri" would be at 100% _alpha, meaning that 200pt marks the edge of the perimeter. If the mouse pointer was at 100pt from "tri", then "tri" would be at 50% _alpha.


-Thanks

Create A Perimeter Around An Object That Detects The Mouse And Triggers An Effect
I have my main movie called "base.fla" in Flash MX. On "base" I have my logo at the upper right corner. It was a graphic symbol, I converted it to a movie clip called "tri".

What I want to happen is when the mouse pointer enters the perimeter of "tri" I want the _alpha action to take affect. The closer the mouse is to "tri" the lower the percentage of _alpha there will be on "tri". Kind of like a motion sensor. If the mouse pointer is X amount of distance from "tri", then "tri" will be X amount _alpha (higher or lower percentage) depending on the mouse's distance from "tri".

Say the mouse pointer is 200pt from "tri", then "tri" would be at 100% _alpha, meaning that 200pt marks the edge of the perimeter. If the mouse pointer was at 100pt from "tri", then "tri" would be at 50% _alpha.


I was given this code to work with, it seems to be on the right track, but I do not know how to alter the code so that it is localized on "tri". This code makes it so that "tri" _alpha is affected by mouse movement, but not within the perimeter of "tri". The mouse is in the wrong location when it affects "tri" _alpha.
Anyway here is the code:
code:
MovieClip.prototype.distance = function(x, y) {
xm = _root._xmouse;
ym = _root._ymouse;
return Math.sqrt(((x-xm)*(x-xm))+((y-ym)*(y-ym)));
}

tri.onEnterFrame = function(){
if(distance(this._x,this._y)<=200){ //200 is optional
this._alpha = distance(this._x,this._y)*.5 //.5 is optional
}else{
this._alpha = 100;
}
}


If you know how to do what I am talking about please lend a hand.

-Thanks

MX2004Pro - Preloader That Triggers Certain Events Depending On Percentage Loaded
Hi there,

below is the action script for frame 1 of my preloader. I'd like to be able to trigger certain events by the percentage of bytes loaded. For example at %50 loaded make an object visible, at %75 percent launch a movieclip on level 5, whatever.

Here's the code:


Code:

bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded = bytes_total) {
this.gotoAndPlay(3);
message = "loading";
}



Frame 2's action script = gotoAndPlay(1); It just repeats the process until both totals are equal then the timeline skips to frame 3 and carries on.




Any idea how to do this?

Countdown Timer That Triggers Random Movie Clip Load
I need help. I have this code here to count down every 10 seconds and load an external random movie clip. It works once, but I would like to have it start the timer again--can anyone help me to achieve this?

code:

displayTime = 5;
function countDown() {
displayTime--;
if (displayTime == 0) {
clearInterval(timer);
trace("Times Up");
container1_mc.loadMovie("ball"+(Math.floor(Math.ra ndom()*3)+1)+".swf", "_root.movieclip");

}
};
timer = setInterval(countDown, 1000);

Movie Clip Timeline Played In Reverse Triggers Multiple Load Events
Howdy

basically I have a movieclip of an animation, which contains 200 frames. the animation's playback is controlled by the _x of the mouse, so the user can shuttle through the animation by moving the cursor from left to right or right to left. OK so far.

when the animation reaches particular points in the animation, i want events to be triggered - so for instance, between frames 50 and 70 of the animation, i want to have a text label appear to specify the contents of that section.

what i've done is to have:

a basic movie clip with a keyframe on frame 50 and a blank keyframe on 70, with the following (approximate) AS:

ActionScript Code:
onClipEvent (load) {
    _root.labelholder.labeltxtbox.label = "Scene 1"
    _root.labelholder.gotoAndPlay(2)
}
onClipEvent (unload) {
    _root.labelholder.labeltxtbox.label = ""
}

hurray! that works fine too. but if i now add a similar clip with different values (label = "Scene 2") further along the timeline, when i shuttle through from left to right, all is well, but when going from right to left, so that playback is in reverse, the load event is triggered several times, BUT ONLY FOR THE SECOND LABEL. no matter where the clip is added, only the first MC on the timeline triggers the load/unload properly.

might make more sense if you have a look at the attached .FLA within the eg.zip.

any solutions or alternative approaches gratefully received...

Specific Html Page Triggers Specific Frame Of The Flash Movie
I have been playing with flash and html and wonder if any of you have a bright idea on how to do this.


I have a flash movie, which I call from html but depending on which part of the html page I call it from I want to start it at a particular frame and not always from the beginning.

I have created a variable within the movie in action script and given it a different value for each of the frames I want to start the movie at, and want now to designate the value I give to that within html so that the movie “jumps” to the correct frame. Is this possible or am I totally crazy??

Mouse-movement Triggers Background Movement - Help Me Find Tutorial
I want to learn how to make an image react on my mouse-movement, so you get the effect as if you're looking around. You move the mouse to the right, and the image on the screen moves to the right, etc. I've seen an example of that on http://www.center-of-the-world.com/ - but I don't know how to find a tutorial for that on the Flashkit-site. Can anyone help?

Image Flip - MouseOver Button Triggers Image Change
Hello all,
My appologies if this question has already been answered if so i must have missed it.

My question is easier to explain by pointing here...

http://www.htmlgoodies.com/beyond/dualflip.html

The thing is the example above is in javascript and i would like to do the same thing in Flash.

Roll the mouse over a button and an image on the stage changes, then being a roll over the "image" natually flips back onMouseout.

i'm thinkin' typ

shownew == image1

on(mousover)
{
shownew(image2);
}
stop()

on(mousout)
{
shownew(image1);
}
stop()

on(press)
do what ever.


Hope this makes sense and please ask for more info if needed, or if possible a tutorial some where. 'cos this would really help me.

Thanks for your time, reading this and even more thanks if you can help me.
Mutex

Copyright © 2005-08 www.BigResource.com, All rights reserved