Jump to content
Search Community

Mouseover Tween MCs. 2 Scenes the same Code

CHA test
Moderator Tag

Recommended Posts

Hello Family :P

 

I have a working Tween Code for 2 Movieclip Link Buttons.

But when i copy my first Flash Scene and put the Code into the Second Scene,

it will not works.

 

1 Error: level 'gall2', Image 225, Line 5 1151: In Definition buttons in the internal namespace is a conflict.

2 Error: 2, level 'gall2', Image 225, Line 10 1021: Duplicate function definition.

 

 

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

var buttons:Array = [art, gall];for (var i:int = 0; i< buttons.length; i++){
   buttons[i].addEventListener(MouseEvent.ROLL_OVER, over);
   buttons[i].addEventListener(MouseEvent.ROLL_OUT, out);
}

function over(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

How can i do it that it works for much of Scenes? :shock:

 

Best Wishes! I hope u can help me! :cry:

 

CHA

Link to comment
Share on other sites

you can't have the same function twice in the same movie. thus the "duplicate" error.

 

if you need to use scenes, just make your instance names and functions unique:

 

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

var buttons2:Array = [art2, gall2];for (var i:int = 0; i    buttons2[i].addEventListener(MouseEvent.ROLL_OVER, over2);
   buttons2[i].addEventListener(MouseEvent.ROLL_OUT, out2);
}

function over2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

notice i put a 2 after every object name.

 

this is one of the reasons scenes aren't used that much any more.

Link to comment
Share on other sites

Hello Carl :P ,

first Thanks for your Time and Reply!

 

Your Idea not works for now.

 

I have change the Code for my 1 Scene and for the 2 Scene.

 

Everything works if only one code is integrated.

 

THE 1 CODE:

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

var buttons1:Array = [art1, gall1];for (var i:int = 0; i< buttons1.length; i++){
   buttons1[i].addEventListener(MouseEvent.ROLL_OVER, over1);
   buttons1[i].addEventListener(MouseEvent.ROLL_OUT, out1);
}

function over1(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out1(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

THE 2 CODE:

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

var buttons2:Array = [art2, gall2];for (var i:int = 0; i< buttons2.length; i++){
   buttons2[i].addEventListener(MouseEvent.ROLL_OVER, over2);
   buttons2[i].addEventListener(MouseEvent.ROLL_OUT, out2);
}

function over2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

I wish to see soon the Light on the End of the Tunnel :lol:

 

Many Thanks for your Time :P

 

CHA

Link to comment
Share on other sites

Yes i did change the instance names of my symbols in scene 2 !!

 

Bevor i had 2 Errors, now only 1:

1 Error: level 'gall2', Image 225, Line 5 1151: In Definition buttons in the internal namespace is a conflict.

 

In "gall2" is the AS3 Code, when i put the Code into another Timeline "art2", then the Error is in them!

 

I wonder why :shock:

 

I have no Idea for now :cry:

 

Greeeetz

 

CHA

Link to comment
Share on other sites

... it has not to do with the Movieclip Names, i build much more other Movieclips and its always the same:

 

The Single Szene is ok but when i run it as one Movie, then the Error comes out:

 

1 Error: level 'gall2', Image 225, Line 5 1151: In Definition buttons in the internal namespace is a conflict.

 

Anyone has an Idea? :oops:

 

Greeeeetttz

 

CHA :cry:

Link to comment
Share on other sites

1 Error: level 'gall2', Image 225, Line 5 1151: In Definition buttons in the internal namespace is a conflict

means that you have tried to define the variable buttons twice in the same scope. (it even gives you the line number where the conflict is occurring...)

 

eg. the following will throw this error:

var buttons = new Array();
var buttons = new Array(1,2,3); // this line 'conflicts with the internal namespace', as buttons is already created as a var

 

Make sure that buttons isn't defined twice and you won't see this error.

Link to comment
Share on other sites

Hi Jamie,

 

thx for your Time, but i cant understand why the Namescape of the Buttons are the Problem!

Carl gives me a Idea to solve 1 of 2 Errors with the "2"!

But now is the "i" the Error!

 

Now i have 2 Scenes and the Code in is:

1 Scene

import com.greensock.*;

var buttons1:Array = [art1, gall1];for (var i:int = 0; i< buttons1.length; i++){
   buttons1[i].addEventListener(MouseEvent.ROLL_OVER, over1);
   buttons1[i].addEventListener(MouseEvent.ROLL_OUT, out1);
}

function over1(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out1(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

2 Scene

import com.greensock.*;

var buttons2:Array = [art2, gall2];for (var i:int = 0; i< buttons2.length; i++){
   buttons2[i].addEventListener(MouseEvent.ROLL_OVER, over2);
   buttons2[i].addEventListener(MouseEvent.ROLL_OUT, out2);
}

function over2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:0xE91F3E});
}
function out2(e:MouseEvent):void {
   TweenMax.to(e.target, 0.3, {tint:null});
}

 

The current Error:

2, level 'art2', Image 225, Line 3 1151: In the definition i in namespace internal is a conflict.

 

What is the "i" :shock:

 

Every Scene is working fine in a separate swf, but when it runs together the "i" Error kicked my Ass :evil:

 

Please, I need the solution :cry:

 

CHA

Link to comment
Share on other sites

In your for loops for adding event listeners, var i:int = 0 is used multiple times.

Just change these variable names to i, j, k etc, or i1, i2, i3 etc

 

eg:

var buttons1:Array = [art1, gall1];for (var i:int = 0; i< buttons1.length; i++){
   buttons1[i].addEventListener(MouseEvent.ROLL_OVER, over1);
   buttons1[i].addEventListener(MouseEvent.ROLL_OUT, out1);
}

becomes

var buttons1:Array = [art1, gall1];for (var i1:int = 0; i1< buttons1.length; i1++){
   buttons1[i1].addEventListener(MouseEvent.ROLL_OVER, over1);
   buttons1[i1].addEventListener(MouseEvent.ROLL_OUT, out1);
}

 

Namespace errors are going to be related to class, function or variable names. If you see these errors, you will be searching for one of these:

class conflictingClassName

function conflictingFunctionName

var conflictingVarName

 

The error also tells you the explicit line that is causing the problem: "2, level 'art2', Image 225, Line 3 1151: In the definition i in namespace internal is a conflict."

As you can see from the timeline code you posted, this error is indeed originating from line 3.

Link to comment
Share on other sites

Iam very happy to have the Resolution for my Flash Object! :D

Jamie, thats it :)

 

First i wanna say THANKS ALOT to "CARL SCHOOF" for his Tips & Support!!

And of course "Jamie Jefferson" for the BIG BIG REST, I embrace you very much!!

 

Action Script is a new World for me and i want learn more about it, time by time.

 

Many Thankx for the Answers of my Questions and .,.,., God bless :P

 

CHA

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...