Question

as3 run a function when mouse down and over an mc

Asked by: cubical38

I have a movie where I have a custom cursor.  On mouse down (held) particle effects are activated and on release or mouse up they stop.  I also have a "wall" made up of several mc's.  When the custom cursor clicks on each individual piece (mc), the piece becomes alpha = 0;  I need to be able to have this happen when the mouse is in the mouse down state.  As to say:  click the mouse down and hold it, as the user navigates the mouse over each piece (mc) a function is fired (the mc becomes alpha = 0)...  I have the function firing, but only when the use clicks the mouse and I want the function to fire regardless of click or mouse over while the mouse is down (held)...  Below is the code for the mouse_down and mouse_up functions.  Below that is the alpha functions  (AS3).  Any help in the right direction is, well, helpful...

Thanks

stage.addEventListener(MouseEvent.MOUSE_DOWN, mouse_down);
stage.addEventListener(MouseEvent.MOUSE_UP, mouse_up);
 
function mouse_down(e:MouseEvent) {
	if (mouseX < 800 && mouseY < 570) {
		timer.start();
		timer2.start();
		Chisel_Sound_active.play();
	}
}
 
/*------function just like above, just for the mouse up event-------*/
function mouse_up(e:MouseEvent) {
 
	timer.stop();
	timer2.stop();
	SoundMixer.stopAll();
	Chisel_WindDown.play();
}
 
 
import fl.transitions.Tween;
import fl.transitions.easing.*;
 
 
ln1.addEventListener(MouseEvent.MOUSE_DOWN, fall);
function fall(event:MouseEvent):void {
 
	ln1.alpha = 0;
 
}
ln2.addEventListener(MouseEvent.MOUSE_DOWN, fall1);
function fall1(event:MouseEvent):void {
 
	ln2.alpha = 0;
 
}
ln3.addEventListener(MouseEvent.MOUSE_DOWN, fall2);
function fall2(event:MouseEvent):void {
 
	ln3.alpha = 0;
 
}
 
...

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-12-11 at 09:01:55ID23976707
Tags

actionscript 3

Topics

Game Programming User Interface

,

ActionScript

Participating Experts
1
Points
500
Comments
24

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. AS3 duplicateMovie
    I have an movieClip with an instance cercle on my stage. I want to duplicate it. I tried: var mc_mc:MovieClip=new MovieClip(); mc_mc.addChild(this.cercle); mc_mc.x=100; this.addChild(mc_mc); var mc2_mc:MovieClip=new MovieClip(); mc2_mc.addChild(this.cercle); mc2_mc.x=100; ...
  2. Help with AS3 event handler. Loading SWF into an MC.
    A colleague in the UK provided a solution to a problem I was having with AS3. I'm very new to Flash 9 and have some experience of AS2 and Flash 8. The colleague provided me a script that will load an external SWF into my movie. I assumed that the script would require me to im...
  3. Timeline Keyframes and AS3
    mc_web is on main timeline. Inside of it are 4 movie clips - mc_B_okr, mc_L_okr, mc_T_okr, and mc_R_okr. These 4 clips have different positions on different key frames. The aim is to scale and pan mc_web (the 4 movie clips scale /pan with it) and click when all the four cl...
  4. Transitioning between content MC's in AS3?
    Hi, im currently trying to make the jump from as2 to as3...which happens to be not so easy; who would have thought.So my question is: i have multiple menu buttons on the stage: btn_home, btn_contact etc and each btn relates to a content movie clip: mc_home, mc_contact ... th...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: section25Posted on 2008-12-11 at 09:28:52ID: 23150312

The problem is that the MOUSE_DOWN event only fires once (when the mouse is clicked). So whatever clip is under the mouse pointer at that time gets the event triggered for it. So if you hold down the mouse button and move the mouse, none of the rolled over clips will receive the event becuase it has already been fired.

So basically what you need to do is have a MOUSE_DOWN listener for the whole stage (not the individual movie clips), and when then check the position of the mouse to see if it is over the position of one of your movie clips. It will be a lot of checking and fairly time consuming, but that seems like the only way to do it, since the check will happen for every frame rather than just the one time the button gets pressed.

 

by: section25Posted on 2008-12-11 at 09:33:02ID: 23150356

To make that a little clearer, create and event listener for the stage so that when the mouse gets cliked it triggers a function. That function, the sets up a listener for the enter_frame event. The function that runs on the enter frame event checks every clip to see if the mouse is over it. Which, if true, will turn it's alpha to 0 (or whatever you want it to do).

Then make sure when you release the mouse with a mouse_up, you remove both listeners.

 

by: cubical38Posted on 2008-12-11 at 09:33:21ID: 23150363

Here is the code I have for detecting when to use custom cursor.  Theoretically, I could use this applied to the mc"s?

stage.addEventListener(MouseEvent.MOUSE_MOVE, moving);
function moving(evt:MouseEvent):void {
	if (mouseX < 800 && mouseY > 570) {
		Mouse.show();
		cursor.visible = false;
		cursor.mouseEnabled = true;
	} else {
 
		Mouse.hide();
		cursor.visible = true;
		cursor.x = stage.mouseX;
		cursor.y = stage.mouseY;
		cursor.mouseEnabled = false;
		evt.updateAfterEvent();
	}
 
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:

Select allOpen in new window

 

by: section25Posted on 2008-12-11 at 09:36:26ID: 23150398

One more thing, the check to see if the mouse is over the movie clip is done by comparing its x,y coordinates to the mouse's x,y corrdinates; not a mouse_over event.

 

by: cubical38Posted on 2008-12-11 at 09:36:31ID: 23150402

Could you give me an example of the syntax for this solution? (enter_frame event)

 

by: section25Posted on 2008-12-11 at 09:37:46ID: 23150412

yes, exactly. run a loop through all of your clips.

 

by: section25Posted on 2008-12-11 at 09:39:07ID: 23150428

stage.addEventListener(Event.ENTER_FRAME, doWhatever);

 

by: section25Posted on 2008-12-11 at 09:41:47ID: 23150458

I don't know if your clips move or not, but if you use the mouse_move event for detection to see if a clip is rolled over, then when a clip moves under the mouse pointer, it will not be detected because the mouse didn't move, the clip did.

 

by: section25Posted on 2008-12-11 at 09:48:41ID: 23150518

I don't know if this is what you were asking for, but here is the complete code:

stage.addEventListener(MouseEvent.MOUSE_DOWN, fireNextListener);

function fireNextListener(e:MouseEvent){
      stage.addEventListener(Event.ENTER_FRAME, checkClips);
}

function checkClips(e:Event){
      
      // run  a loop through all of your clips to see if they are under the mouse pointer
      
}

stage.addEventListener(MouseEvent.MOUSE_UP, removeClipListener);

function removeClipListener(e:EVENT){
      stage.removeEventListener(Event.ENTER_FRAME, checkClips);
}

 

by: cubical38Posted on 2008-12-11 at 09:49:09ID: 23150521

if (mouseX < 800 && mouseY > 570)  As this is setup, can i define different areas as the stage.  As to say, three squares within the movie with space between them.  The clips will be stationary and only alpa out to 0.  Do I have this setup correctly?  I guess I am not seeing how flash will recognize each individual mc...




stage.addEventListener(Event.ENTER_FRAME, fall);
 
function fall(event:ENTER_FRAME):void {
    if (mouseX < 800 && mouseY > 570){
	ln1.alpha = 0;
    }   
}

                                              
1:
2:
3:
4:
5:
6:
7:

Select allOpen in new window

 

by: cubical38Posted on 2008-12-11 at 09:54:16ID: 23150560

This is exactly what I am looking for,but where do I place the actual function for each mc?:  ln1, ln2...  each mc's
ln1.addEventListener(MouseEvent.MOUSE_DOWN, fall);
function fall(event:MouseEvent):void {
 
        ln1.alpha = 0;
 
}
ln2.addEventListener(MouseEvent.MOUSE_DOWN, fall1);
function fall1(event:MouseEvent):void {
 
        ln2.alpha = 0;
 
}
)

 

by: section25Posted on 2008-12-11 at 09:59:15ID: 23150597

sorry, I didn't check my syntax. This line should have been lower case Event.

function removeClipListener(e:Event){

------------------------------------------------------------

Each movie clip does not get a function anymore. Instead, you would check the clip's X,Y coordinates to see if it is under the mouse's pointer. As in:
 

if(mouse.x > clip.x && mouse.x < clip.x+clip.width && mouse.y > clip.y and mouse.y < clip.y+clip.width){
    // the mouse is over the clip
}

 

by: cubical38Posted on 2008-12-11 at 10:03:18ID: 23150627

I believe this is enough to get me rolling...  I am going to apply everything you have given me here and I should be able to put it together and get it working...  Thanks alot, and I am clicking accept as solution so you will be sure and get you points...

Thanks again...

 

by: section25Posted on 2008-12-11 at 10:11:20ID: 23150703

One more thing, I just learned something myself in trying to solve this: you can still trigger the mouse_over with the mouse button held down. So this code would be a bit easier instead of checking the X,Y coords.

stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips);

function checkClips(e:MouseEvent){
      clip1.addEventListener(MouseEvent.MOUSE_OVER, doSomething);
}

function doSomething(e:Event){
      trace("the mouse is over this clip");
}

function removeCheckClips(e:Event){
      clip1.removeEventListener(MouseEvent.MOUSE_OVER, doSomething);
}


However, you'll need a different function for each clip if you want to know which clip was clicked on. But I learned a cool trick recently which I'll pass along in my next post which, if it doesn't help in this problem, you can certainly use it later. It took me a long time to find it.

 

by: section25Posted on 2008-12-11 at 10:28:59ID: 23150875

You really only need to do this if you want to remove the event listeners (which you should do all the time anyway).

When you add an event listener, you give it a label, as in:

stage.addEventListener(Event.ENTER_FRAME, thisIsTheLabel);

The label is the same name as your function that will be performed. But what if you want to pass some variable to the function? With this setup, you can't. Because this will give you a syntax error:

stage.addEventListener(Event.ENTER_FRAME, thisIsTheLabel(somevar));

So you could just put the function in line with the listener like this:

stage.addEventListener(Event.ENTER_FRAME, function(e:Event) { do something here} );

But now, you can't remove the listener becuase you didn't give it a label. To remove a listener, it MUST be given a label.

Now here's the trick: set up the label as a varible typed as a function that points to another function. Like this:

var myFunction = function(e:Event):void {check_clip(1)};
  // then create your listener and use this variable as your label
clip1.addEventListener(MouseEvent.MOUSE_OVER, myFunction);

Now, when clip1 gets a mouse over triggered, it will call the function check_clip and send it a parameter of 1. AND you can remove the listener because it has a label.

So while you still have to setup a variable for each clip and a listener for each clip, you don't have to recreate the same function over and over again. You can just use the same function, because now it can be passed a parameter (or as many parameters as you like). As is:

function check_clip(a){
  // set the alpha for ["clip"+a] to 0;
   parent["clip"+a].alpha = 0;
}

Anyway, this has helped me tremendously.

Good Luck. Glad I could help.






 

by: cubical38Posted on 2008-12-11 at 11:29:01ID: 23151415

I am receiving this error when the clips are within another movieclip:

TypeError: Error #1010: A term is undefined and has no properties.
      at HiltiSplash_v2_fla::leftNav_mc_43/check_clip()
      at MethodInfo-333()

And this error when I break apart that movie clip and place the code on the main timeline:

ReferenceError: Error #1069: Property clip1 not found on flash.display.Stage and there is no default value.
      at HiltiSplash_v2_fla::MainTimeline/check_clip()
      at MethodInfo-298()

Any thoughts?

 

by: section25Posted on 2008-12-12 at 05:53:53ID: 23157111

You probably have scoping issues. Its kind of hard to tell what is going on without seeing your code, but another lesson I've had to learn the hard way, is that you really should not put actionscript code anywhere but on the main timeline. Once you start embedding code into clips and other objects, it makes things really difficult to troubleshoot.

Other than that, I would just try to examine the contents of your stage and the objects on it to see the hierarchy and what the parent clips are and what the child clips are and try to keep everything organized.

A quick run through of your objects could be done like this:

var s:DisplayObject;
for(a=1;a<=this.numChildren-1;a++){
      s = this.getChildAt(a);
      trace(s.name, getChildAt(s));
}



 

 

by: cubical38Posted on 2008-12-12 at 07:12:32ID: 23157780

I'll keep trying a few things,  I am really close, so thanks for all the help...

 

by: cubical38Posted on 2008-12-12 at 09:18:07ID: 23159045

How would I run a conditional statement to see if all of the clips were alpha = 0;?

 

by: section25Posted on 2008-12-12 at 11:27:39ID: 23160202

I don't know what the parent of you clips is but that would matter.

for(a=1;a<=number_of_clips;a++){
if(parent["clip"+a].alpha  == 0){
   do something here
}
else {
   do something else here
}
}

 

by: cubical38Posted on 2008-12-15 at 12:07:31ID: 23177213

var numOfItems:int = 15;
var mc:MovieClip;

for (var i:int = 0; i < numOfItems; i++) {
      mc = new MovieClip();
      mc.name = "clip" + i;

      trace(mc.name);

}// end for

for (i=1; i<=15; i++) {
      if (["clip"+i].alpha  == 0) {
            gotoAndStop("stamp");
      } else {
      }
}
  The trace is working and with the individual functions the mc's are becoming alpha, yet, I am unable to:  gotoAndStop("stamp");....

Any suggestions?

 

by: section25Posted on 2008-12-15 at 13:58:25ID: 23178390

which clip are you trying to gotoAndStop "clip1" or the parent clip?

the parent would be:
this.gotoAndStop("stamp");

make sure you have a frame named "stamp".

 

by: cubical38Posted on 2008-12-15 at 14:09:45ID: 23178489

I have tried both.  Here is the entire piece of code within a movieclip on the main timeline.  I tried it within a movieclip and with the mc'c on the main timeline.  Its as if it is not recognizing that the clips are alpha or looking for more?

The code below is on the 1st frame within the movieclip.

"stamp" is on the 4th frame on the main timeline...

I couldnt get the function for alpha working unless I wrote it out as below///

import fl.transitions.Tween;
import fl.transitions.easing.*;
 
 
 
 
var numOfItems:int = 15;
var mc:MovieClip;
 
for (var i:int = 0; i < numOfItems; i++) {
	mc = new MovieClip();
	mc.name = "clip" + i;
 
	trace(mc.name);
 
}// end for 
 
 
 
for (i=1; i<=15; i++) {
	if (["clip"+i].alpha  == 0) {
		this.gotoAndPlay("stamp");
	} else {
	}
}
 
 
 
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips);
 
function checkClips(e:MouseEvent) {
	clip1.addEventListener(MouseEvent.MOUSE_OVER, doSomething);
}
 
function doSomething(e:Event) {
	clip1.alpha = 0;
}
 
function removeCheckClips(e:Event) {
	clip1.removeEventListener(MouseEvent.MOUSE_OVER, doSomething);
}
 
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips2);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips2);
 
function checkClips2(e:MouseEvent) {
	clip2.addEventListener(MouseEvent.MOUSE_OVER, doSomething2);
}
 
function doSomething2(e:Event) {
	clip2.alpha = 0;
}
 
function removeCheckClips2(e:Event) {
	clip2.removeEventListener(MouseEvent.MOUSE_OVER, doSomething2);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips3);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips3);
 
function checkClips3(e:MouseEvent) {
	clip3.addEventListener(MouseEvent.MOUSE_OVER, doSomething3);
}
 
function doSomething3(e:Event) {
	clip3.alpha = 0;
}
 
function removeCheckClips3(e:Event) {
	clip3.removeEventListener(MouseEvent.MOUSE_OVER, doSomething3);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips4);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips4);
 
function checkClips4(e:MouseEvent) {
	clip4.addEventListener(MouseEvent.MOUSE_OVER, doSomething4);
}
 
function doSomething4(e:Event) {
	clip4.alpha = 0;
}
 
function removeCheckClips4(e:Event) {
	clip4.removeEventListener(MouseEvent.MOUSE_OVER, doSomething4);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips5);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips5);
 
function checkClips5(e:MouseEvent) {
	clip5.addEventListener(MouseEvent.MOUSE_OVER, doSomething5);
}
 
function doSomething5(e:Event) {
	clip5.alpha = 0;
}
 
function removeCheckClips5(e:Event) {
	clip5.removeEventListener(MouseEvent.MOUSE_OVER, doSomething5);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips6);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips6);
 
function checkClips6(e:MouseEvent) {
	clip6.addEventListener(MouseEvent.MOUSE_OVER, doSomething6);
}
 
function doSomething6(e:Event) {
	clip6.alpha = 0;
}
 
function removeCheckClips6(e:Event) {
	clip6.removeEventListener(MouseEvent.MOUSE_OVER, doSomething6);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips7);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips7);
 
function checkClips7(e:MouseEvent) {
	clip7.addEventListener(MouseEvent.MOUSE_OVER, doSomething7);
}
 
function doSomething7(e:Event) {
	clip7.alpha = 0;
}
 
function removeCheckClips7(e:Event) {
	clip7.removeEventListener(MouseEvent.MOUSE_OVER, doSomething7);
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips8);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips8);
 
function checkClips8(e:MouseEvent) {
	clip8.addEventListener(MouseEvent.MOUSE_OVER, doSomething8);
}
 
function doSomething8(e:Event) {
	clip8.alpha = 0;
}
 
function removeCheckClips8(e:Event) {
	clip8.removeEventListener(MouseEvent.MOUSE_OVER, doSomething8);
}
 
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips9);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips9);
 
function checkClips9(e:MouseEvent) {
	clip9.addEventListener(MouseEvent.MOUSE_OVER, doSomething9);
}
 
function doSomething9(e:Event) {
	clip9.alpha = 0;
}
 
function removeCheckClips9(e:Event) {
	clip9.removeEventListener(MouseEvent.MOUSE_OVER, doSomething9);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips10);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips10);
 
function checkClips10(e:MouseEvent) {
	clip10.addEventListener(MouseEvent.MOUSE_OVER, doSomething10);
}
 
function doSomething10(e:Event) {
	clip10.alpha = 0;
}
 
function removeCheckClips10(e:Event) {
	clip10.removeEventListener(MouseEvent.MOUSE_OVER, doSomething10);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips11);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips11);
 
function checkClips11(e:MouseEvent) {
	clip11.addEventListener(MouseEvent.MOUSE_OVER, doSomething11);
}
 
function doSomething11(e:Event) {
	clip11.alpha = 0;
}
 
function removeCheckClips11(e:Event) {
	clip11.removeEventListener(MouseEvent.MOUSE_OVER, doSomething11);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips12);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips12);
 
function checkClips12(e:MouseEvent) {
	clip12.addEventListener(MouseEvent.MOUSE_OVER, doSomething12);
}
 
function doSomething12(e:Event) {
	clip12.alpha = 0;
}
 
function removeCheckClips12(e:Event) {
	clip12.removeEventListener(MouseEvent.MOUSE_OVER, doSomething12);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips13);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips13);
 
function checkClips13(e:MouseEvent) {
	clip13.addEventListener(MouseEvent.MOUSE_OVER, doSomething13);
}
 
function doSomething13(e:Event) {
	clip13.alpha = 0;
}
 
function removeCheckClips13(e:Event) {
	clip13.removeEventListener(MouseEvent.MOUSE_OVER, doSomething13);
}
 
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips14);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips14);
 
function checkClips14(e:MouseEvent) {
	clip14.addEventListener(MouseEvent.MOUSE_OVER, doSomething14);
}
 
function doSomething14(e:Event) {
	clip14.alpha = 0;
}
 
function removeCheckClips14(e:Event) {
	clip14.removeEventListener(MouseEvent.MOUSE_OVER, doSomething14);
}
stage.addEventListener(MouseEvent.MOUSE_DOWN, checkClips15);
stage.addEventListener(MouseEvent.MOUSE_UP, removeCheckClips15);
 
function checkClips15(e:MouseEvent) {
	clip0.addEventListener(MouseEvent.MOUSE_OVER, doSomething15);
}
 
function doSomething15(e:Event) {
	clip0.alpha = 0;
}
 
function removeCheckClips15(e:Event) {
	clip0.removeEventListener(MouseEvent.MOUSE_OVER, doSomething15);
}

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:

Select allOpen in new window

 

by: cubical38Posted on 2008-12-15 at 14:19:11ID: 23178576

When I break apart the movieclip and have all the clips on the main timeline I get these errors for every clip:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at HiltiSplash_v3_fla::MainTimeline/checkClips()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at HiltiSplash_v3_fla::MainTimeline/checkClips2()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
      at HiltiSplash_v3_fla::MainTimeline/checkClips3()

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...