1021: duplicate function definition.

Well, I'm trying to generate a random number and send users to this keyframe in flash but I get errors

Symbol "WholeFile", layer 'actions', frame 3, line 3-1151: there is a conflict with speed of definition in the internal namespace.

Symbol "WholeFile", layer 'actions', frame 3, line 4 1021: duplicate function definition.

on each of the key frames for the random number.

Here is the code:

On the main generator

var top: Number = 13;

var low: Number = 1;

var district = (Match.floor (Math.random () *(1+high-low)) + low) m:System.NET.SocketAddress.ToString ();

if(district == 1)

{

gotoAndStop ("district1");

}

Another yew (district == 2)

{

gotoAndStop ("district2");

}

Another yew (district is 3)

{

gotoAndStop ("district3");

}

Another yew (district is 4)

{

gotoAndStop ("district4");

}

Another yew (district == 5)

{

gotoAndStop ("district5");

}

Another yew (district is 6)

{

gotoAndStop ("district6");

}

Another yew (district is 7)

{

gotoAndStop ("district7");

}

Another yew (district is 8)

{

gotoAndStop ("district8");

}

Another yew (district is 9)

{

gotoAndStop ("district9");

}

Another yew (district is 10)

{

gotoAndStop ("district10");

}

Another yew (district is 11)

{

gotoAndStop ("district11");

}

Another yew (district is 12)

{

gotoAndStop ("district12");

}

ElseIf (District == 13)

{

gotoAndStop ("capitol");

}

on the chassis number generated

Fl.transitions import. *;

Fl.transitions.easing import. *;

var speed: number = 3;

function comeToMe(event:MouseEvent) {}

var obj:Object = event.target;

var tweenX:Tween = new Tween (plyr, 'x', None.easeNone, plyr.x, obj.x, speed, true);

var tweenY:Tween = new Tween (plyr, "y", None.easeNone, plyr.y, obj.y, speed, true);

addEventListener (Event.ENTER_FRAME, loopFunction);

var obj_clip:MovieClip = obj as MovieClip;

function loopFunction(event:Event):void {}

{if (plyr.hitTestObject (obj_clip))}

status_txt. Text = "Welcome" + obj_clip.name + "have fun!";

tweenX.stop ();

tweenY.stop ();

removeEventListener (Event.ENTER_FRAME, loopFunction);

}

}

}

bank.addEventListener (MouseEvent.CLICK, comeToMe);

home.addEventListener (MouseEvent.CLICK, comeToMe);

business.addEventListener (MouseEvent.CLICK, comeToMe);

Please help and tell me what's wrong with my code!

Repeating code in different settings?

Tags: Adobe Animate

Similar Questions

  • Error: 1021: duplicate function definition.

    Hi all

    First of all, let me start by saying that I know almost nothing about Flash.  I inherited a Web site maintenance project that has a rotating image Flash banner.  I managed to get the image fade-in / fade-out properly, but now I need to make these clickable images - link images to pages in the Web site.  I read a lot of posts here and went through the video tutorials.  I was able to get the first image map using this AS3 action:

    mars_btn.addEventListener (MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler(event:MouseEvent): void {}
    navigateToURL (new URLRequest ("http://somewebsite/mars.php"));
    trace ("clicked");
    }

    However, when I try to make another clickable image using another instance of a button I get the error message:

    1021: duplicate function definition.

    I have a separate instance of a button with this AS3 action:

    jupiter_btn.addEventListener (MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler(event:MouseEvent): void {}
    navigateToURL (new URLRequest ("http://somewebsite/jupiter.php"));
    trace ("clicked");
    }

    I'm obviously not understand how I'm supposed to do this so that I don't create a duplicate function definition.  Any help would be most appreciated.

    If you don't know anything about AS then the easiest just to rename the methods of the Manager to unique names

    mars_btn.addEventListener (MouseEvent.CLICK, MarchClickHandler);
    MarchClickHandler(event:MouseEvent) function: void {}
    navigateToURL (new URLRequest ("http://somewebsite/mars.php"));
    trace ("clicked");
    }

    jupiter_btn.addEventListener (MouseEvent.CLICK, jupiterClickHandler);
    jupiterClickHandler(event:MouseEvent) function: void {}
    navigateToURL (new URLRequest ("http://somewebsite/jupiter.php"));
    trace ("clicked");
    }

  • 1021: duplicate function definition, I'm lost... Please advise

    I'm obviously new to as3... So I have 3 buttons (all in the same scene) that everyone should go to a different scene. I put the script on the same chassis. Here's the script:

    btn_pg.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void {}

    Stop (1, "photo_gallery");

    }

    btn_vg.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void {}

    Stop (1, "photo_gallery");

    }

    This is the error it gives me:
    home_1, layer 'actions', image1, line 8 1021: duplicate function definition.
    What you have to do to use the same function for the various buttons to access different scenes?
    I thank you for any consideration and help,
    Thomas

    for different scenes...:

    btn_pg.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);
    btn_vg.addEventListener (MouseEvent.MOUSE_DOWN, mouseDownHandler);

    function mouseDownHandler(event:MouseEvent):void
    {
    var nameOfButton:String = event.currentTarget.name;
    If (nameOfButton is "btn_pg")
    {
    Stop (1, "photo_gallery");
    }
    Else if (nameOfButton == "btn_vg")
    {
    Stop (1, "video_gallery");
    }

    }

  • Duplicate function definition error

    Hi all!

    Among the more boring for errors is the error "duplicate definition of the function. I appreciate that Flash does not want to see the same function twice...

    ... But what of the same function used in two different sections (labels) to a site? I have two different slideshows in two different sections of my site, and I need the same function shouted for everyone.

    The function is function nextImage (): void

    If I remove one, this slideshow does not work (still fixed on frame 1 of the slideshow)... If I keep it in, nothing works!

    Ideas for a workaround? I wanted to use the same script for the two shows, but forget it! So, I found another script to another type of slideshow. I thought that I would be safe taking this approach. Apparently not.

    Thank you!!!

    I don't know if someone else will have to offer, but if you have a problem of double function for two slide show different designs, rename this function in one of them.

  • Need help for a function 1021:Duplicate of setting definition

    Hello, I know where is the duplicate function, but I can't understand how to remove without causeing more errors. Help, please!

    import flash.events.MouseEvent;
    import flash.media.Sound;
    import flash.net.URLRequest;

    var myMusic:Sound = new Sound();
    var soundFile:URLRequest = new URLRequest ("lpwfte.mp3");
    channel: var SoundChannel = new SoundChannel();

    buttonPlay.addEventListener (MouseEvent.CLICK, playMusic);
    BTN. Stop.addEventListener (MouseEvent.CLICK, stopMusic);

    function playMusic(evt:MouseEvent):void
    {
    Channel.Stop ();
    }

    function playMusic(evt:MouseEvent):void
    {
    myMusic.load (soundFile);
    Channel = myMusic.play ();
    }

    Shouldn't the name of the first function that the list is 'stopMusic '?

  • Confusing function definition

    Hello

    Function definition is confusing me.

    I have run the statement.

    Select translate ('test', 't', ' a') of double

    It returns "EASA".

    That means it replaces 't' by 'a '.

    I have run this statement.

    Select double TRANSLATE('Q12345','12345','OK')

    It returns "MOK".

    It replaces '12345' with 'OK '.

    Now I run it,

    Select double TRANSLATE('Q12345','12345','')

    Returns a NULL value.

    But he should have come back 'Q' right?

    My understanding is incorrect?

    Help me understand this

    Hello

    872483 wrote:

    Hello

    Function definition is confusing me.

    If you don't understand how a built-in function, search for it in the manual of the SQL language:

    https://docs.Oracle.com/database/121/SQLRF/functions231.htm#sthref2078

    I have run the statement.

    Select translate ('test', 't', ' a') of double

    It returns "EASA".

    That means it replaces 't' by 'a '.

    Exactly!  TRANSLATE returns a copy of its 1st argument, but with the n-th argument 2 character (' t ' in this case) changed the character n-th of the 3rd argument ("a" in this case).

    The 1st character of ' t ' is ' t ' and the 1st character 'a' is 'a', then all the t are replaced by 'the

    I have run this statement.

    Select double TRANSLATE('Q12345','12345','OK')

    It returns "MOK".

    It replaces '12345' with 'OK '.

    Not quite; It replaces the n-th of the argument character 2nd with character n-th of the argument in the 3rd.

    The 1st character of 'Q12345' is 'Q', and the 1st character of 'OK' is 'o', then all the ' Q will be changed to ' O

    [OP caught this mistake;] See response below #3.  I meant "the 1st"12345"character is '1', and the 1st character of 'OK' is 'o', so all 1 will be replaced by"O ".

    I made the same kind of mistake on the lines immediately below.]

    The 2nd character of "Q12345" is '1', and the 2nd character of 'OK' is 'K', and change all the 1 to ' K

    The 3rd character of 'Q12345' is '2', and there is no 3rd character in 'OK', so will be removed from all 2.  In other words, there is no 3rd character in 'OK', there will be no 2 accordingly.

    The same for the 4th, 5th and 6th characters of 'Q12345' (i.e., '3', ' 4 'and 5').

    Now I run it,

    Select double TRANSLATE('Q12345','12345','')

    Returns a NULL value.

    But he should have come back 'Q' right?

    My understanding is incorrect?

    Help me understand this

    TRANSLATE returns NULL if any of its arguments are NULL (and "with nothing between single quotes is equivalent to NULL).

    REPLACE ('Q12345', '12345', ") would return 'Q', but TRANSLATING is not identical to REPLACE.

  • How to "end" to the function definition in SQL like?

    I'm using Oracle 11 g and SQL Plus.

    I'm trying to define a function and return to the SQL command prompt, but it is simply not to leave the function definition.

    SQL > create function dept_count (dept_name varchar (20))
    2 returns whole
    3. start
    4 declare entire d_count;
    5. select count (*) in d_count
    6 the instructor
    7 where instructor.dept_name = dept_name
    8 return d_count;
    9 end
    10;
    11
    12
    13
    14
    15
    16.
    end 17 dept_count;
    18;
    19
    20; <-I expect the SQL > invite here, but it is not.

    What should I do? Help, please. Thank you.

    Try this please

    .
    .
    .
    SQL> end ;
    SQL> /
    
  • Function definition

    Hello
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    "CORE     11.2.0.1.0     Production"
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    I'm trying to understand the function of 'translating ';

    EG1:
     select translate('MikeNike','ee','i') Trans from dual;
    
    
    TRANS
    ----------
    MikiNiki
    I was expecting that there is no "ee" channel... This release should give even as input.but, it isn't.

    EG2:
     select translate('MikeNIke','eN','i') Trans  from dual;
    
    TRANS
    ----------
    MikiNiki
    It replaced the string 'fr' with 'i' and 'e' by 'i '.

    Could someone explain me bit it?


    Thank you
    SG

    Hello

    Read the docs:

    TRANSLATE (expr, from_string, to_string)

    TRANSLATE returns expr with all occurrences of each character in from_string replaced by its corresponding character in to_string.
    From_string argument can contain more characters than to_string. In this case, the additional characters at the end of from_string have no corresponding character in to_string.
    If a character occurs more than once in from_string, then the mapping of to_string corresponding to the first occurrence is used.
    >

    Then,

    select translate('MikeNike','ee','i') Trans from dual
    

    is equal to

    select replace('MikeNike','e','i') Trans from dual
    

    and

    select translate('MikeNIke','eN','i') Trans  from dual
    

    is equal to

    select replace(replace('MikeNIke','e','i'), 'N') Trans from dual
    
  • The compiler bug? Var statement above the postcedes function being called external execution function definition

    Use Flash CS5 (AIR and, although this does not seem that it would be AIR bound) in Win XP 64


    I have a MovieClip symbol in my library with the identifier 'Puzzle10Piece10' with the following actionscript code attached to frame 1 of the single layer with the following actionscript code:

    Import 12345678910111213import;
    import flash.display.Sprite;

    var bmpSprite:Sprite = new Sprite();
    addChild (bmpSprite);
    trace ("*" + bmpSprite + "*");

    function addBMP(b:Bitmap):void
    {
    trace ("=" + bmpSprite + "=");
    BMP = b;
    bmpSprite.addChild (b);
    }

    I have the following text in a class AS file:

    If (name is "GoalCard")
    {
    var p10:Puzzle10Piece10 = new Puzzle10Piece10();
    trace (new Bitmap (p.getImages (). Hallway [1]));
    variableArea.addChild (p10);
    P10.addBMP (Bitmap (p.getImages (again). Hallway [1]));
    }

    Produces the following output:

    CLASS: PictureTools FUNCTION getImages() return [[object Object]]
    [object Bitmap]
    CLASS: PictureTools FUNCTION getImages() return [[object Object]]
    ========== null ===========
    Bland (out) lightbox FEATURE
    [object Sprite] *.

    The "trace (new Bitmap (...". "is only to show that I am sending a valid bitmap object to the function, I'll call you.

    This goes against my understanding of the pre-compiler and code execution order.  In my way of thinking, any creation of reference and memory related distribution is performed when the object is instantiated, and indeed that allocation, unlike C does not depend on code order (statement before use), although it is a command that can reach even the C pre-compiler.  If I understand correctly the compiler in Flash at all, it's not even a question of "order of the code"... the symbol is pre-compiled such that it exists... so that it can be instantiated, the variable would exist before the function would be "available" to be called internally or externally.

    Is my way of thinking to the coast, or is this a bug?

    at least since flash mx.

  • CREATE (or REPLACE) procedure_definition | function definition

    A manual I read says to use the function CREATE or REPLACE function, but my function will not compile with one of these. It compiles only when I use the FUNCTION itself. The CREATION or replacement is no longer used in Oracle 10 g?

    Thank you

    Rich75 wrote:
    I tried in SQL * more and it worked for me too, but I usually use SQL Navigator. That's where I got the error.

    I'm pretty new to Oracle, so I probably don't understand some things too well. I realized that when I created the function in SQL * Plus, it appeared in SQL Navigator under functions. I created this function in a package, so I think it's a little different than the creation of a global function.

    Published by: Rich75 on January 27, 2010 10:02

    Yes, OK if you create a function inside a package, then you do not have to give create or replace keywords.

  • Function DEFINITION, remove the chain alpha characters

    I'm on 11g.

    I need to remove the alpha of a string characters, leaving only numbers, but I get unexpected results:
    SQL > SELECT TRANSLATE ('3N', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', NULL) a FROM DUAL;
    A
    -

    I thought that this would leave 3 of the 3N, but it returns an empty string. For my application, the string "3N" could be any length, will contain only letters and numbers and letters will always come at the end, but there might be more than one letter
    VALID INPUT samples:
    4
    25
    11F
    361NG
    8ABC

    Is there a better way?

    You must give a valid replacement at least, and then the rest will be replaced with null as the address:

    SELECT TRANSLATE('3N', '1ABCDEFGHIJKLMNOPQRSTUVWXYZ', '1') a FROM DUAL;
    

    Published by: chris227 on 07.02.2013 08:37
    Sorry, I forgot the 1 in the second parameter

  • Error 1021: Double Definition function.

    Hello I have a small problem... I want to do different buttons 2-5, but have the same script action.
    1 is perfect using the code. but when I do another button and duplicate the action script to bind.
    problem occupation error 1021: duplicate function definition.

    Here is my code:

    -----

    playPauseToggle_mc.addEventListener (MouseEvent.CLICK, fl_togglePlayPause);

    function fl_togglePlayPause(evt:MouseEvent):void

    {

    If (playPauseToggle_mc.currentLabel is "play")

    {

    playPauseToggle_mc.gotoAndStop ("pause");

    }

    Else if (playPauseToggle_mc.currentLabel == "Paused")

    {

    playPauseToggle_mc.gotoAndStop ("play");

    }

    }

    playPauseToggle2_mc.addEventListener (MouseEvent.CLICK, fl_togglePlayPause);

    function fl_togglePlayPause(evt:MouseEvent):void

    {

    If (playPauseToggle2_mc.currentLabel is "play")

    {

    playPauseToggle2_mc.gotoAndStop ("pause");

    }

    Else if (playPauseToggle2_mc.currentLabel == "Paused")

    {

    playPauseToggle2_mc.gotoAndStop ("play");

    }

    }

    ----

    Please help me with this one. Thank you in advance.

    The main problem with what you have done is exactly what means the error message.  You define two different functions with the exact function of the same name... fl_togglePlayPause

    If you were to rename the function second to be fl_togglePlayPause2, then that would solve this problem.

    But for the code, you are showing you could just as easily have all the buttons use the same unique function if you rewrite just that work a little to be generic by using the event information...

    function fl_togglePlayPause(evt:MouseEvent):void

    {

    var toggleBtn:MovieClip = MovieClip (evt.currentTarget);

    If (toggleBtn.currentLabel is "play")

    {

    toggleBtn.gotoAndStop ("pause");

    }

    Else if (toggleBtn.currentLabel == "Paused")

    {

    toggleBtn.gotoAndStop ("play");

    }

    }

    With this approach simply the defined function and all your buttons can share.

  • Double function of error definition: 1021

    Hello world

    I have several buttons in my project that I coded like the one below, I had them all workers but had to return to my project and receive the error: 1021 duplicate function definition

    Stop();
    btn_start_session.addEventListener (MouseEvent.MOUSE_DOWN, myBtnHandler13);
    function myBtnHandler13(event:MouseEvent):void {}
    Stop (1, "Open_Live");
    }

    I have also several scenes the project some with several buttons per page.

    Somewhere, you use the same name of function for more than one function.

  • Make a function run on specific bases

    I want to use it on multiple images however, when I do, I get an error.

    The text block is named--> theText

    1 stop();

    2 var str:String = "Sample text".

    3

    4 sInt var = setInterval(writeIt,20);

    Number: 5 var count = 0;

    6

    7 function writeIt() {}

    8 theText.text = str.substring(0,count);

    9 count ++;

    10 if (number > str.length) {}

    clearInterval (sInt);

              }

    }

    Line 2 1151: there is a conflict with definition str. in the internal namespace.

    Line 4 1151: there is a conflict with internal sInt within names definition.

    Line 5 1151: there is a conflict with the County of definition in the internal namespace.

    Line 7 1021: duplicate function definition.

    How to use this feature on other images?
    Also, I considered that it would be some kind of class I need to import, I don't know, I'm still new ACE and I and more familiar with AS2.

    Instead of setInterval, why not use a timer?

    You could do something like this:

    Open a new AS3 file in your Flash CSX and type in the first image, copy the following code:

    stop();
    
    var theText:TextField = new TextField();
    addChild(theText);
    
    var str:String = "firstText";
    
    var waitingTime:int = 100;
    var timesToLoop:int;
    var count:uint = 0;
    
    var myTimer:Timer = new Timer(waitingTime, str.length+1);
    myTimer.addEventListener("timer", writeIt);
    
    myTimer.start();
    
    function writeIt (e:TimerEvent) {
         textToWrite(str);
    }
    
    function textToWrite (s:String):void {
         str = s;
         theText.text = str.substring(0,count);
        count++;
        if(count > str.length) {
              count = 1;
              myTimer.reset();
              trace("done");
              nextFrame();
         }
    }
    

    In the second frame, type:

    str = "secondText";
    myTimer.start();
    

    In the third image, type:

    str = "thirdText";
    myTimer.start();
    

    And so on...

    BTW, in your example, when inside your statement if you forget to reset the count var.

    You should have something like this:

    If (count > strToBeChanged.length) {}

    clearInterval (sInt);

    Count = 0;

    }

    But I did not test to see if this is the only problem. In any case, my example with timer works fine.

  • Re-use of a listener of events and function over several periods

    Hi, I would like a clip called 'following_cursor_mc' to follow the cursor, no matter which of several different frames, the read head can be on.  I have reproduced the code below on each frame in which I want the cursor that will be followed by "following_cursor_mc", but these errors are raised for each of the images:

    1021: duplicate function definition.

    It's true.

    Good luck.

    L

Maybe you are looking for

  • Thunderbolt Windows 7 external hard drive

    Hello world I would describe my plan and ask advice on what defects or difficulties I'm likely to encounter! I recently moved from Windows 7 PC to imac, but I need for the operation of some Windows programs too. I don't want to use my internal drive

  • probs with CD writing

    my laptop is g62 140es models, I have a problem it jst appeared now am trying to burn a CD. Unfortunately, it shows the process, like everything is ok, then finally to open the rom as the work is carried out. then when I try to listen to the probe wh

  • WHS2011 install fails

    I try to install WHS 2011 on a new server HP Proliant Micro blade, but it keeps failing.  I have a 260 GB HD, 4 GB of ram.  It loads for about 10 minutes, then stops with an error, but it is not clear whit you mistake could be.  The last line in the

  • my desktop image has ii in landscape mode. How can I change to the portrait. Using Windows XP

    I accidentally hit the keyboard and the image of the desktop screen changed to landscape

  • Down sizing my windows screen, it is great

    I changed my tour at a hp 5550 for a 503. The image go up my perfect of the screen. Now with the 503 is big I have to scroll I have tried to shring nothing works down and average sides upward to see the entire page. Can you tell me what I can do?