addChild error messages
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: addChild error messages

  1. #1
    Registered User
    Join Date
    Apr 2014
    Posts
    2

    addChild error messages

    hi I am working on a dress up game using this courses drag and drop method i have 17 dresses i want to import when I press the dresses button

    var TeapContainer:MovieClip=new MovieClip;
    addChild(TeapContainer);

    var HSContainer:MovieClip=new MovieClip;
    addChild(HSContainer);

    var FrenchKwiggleContainer:MovieClip=new MovieClip;
    addChild(FrenchKwiggleContainer);

    function clickdresses(event:MouseEvent):void{
    var myTeap:MovieClip = new Teap();
    TeapContainer.addChild(myTeap);
    }
    Teap.addEventListener(MouseEvent.CLICK, clickdresses);

    function clickdresses(event:MouseEvent):void{
    var myHS:MovieClip = new HS();
    HSContainer.addChild(myHS);
    }
    HS.addEventListener(MouseEvent.CLICK, clickdresses);

    function clickdresses(event:MouseEvent):void{
    var myFrenchKwiggle:MovieClip = new FrenchKwiggle();
    FrenchKwiggleContainer.addChild(myFrenchKwiggle);
    }
    FrenchKwiggle.addEventListener(MouseEvent.CLICK, clickdresses);

    I get the error message 1021uplicate function definition
    if i take out the function method i get a 1046 error message

    I've tried creating a container and adding them it doesn't work
    I don't understand as I am using the same coding that I used
    for my dolls but they each had their own button.
    please help I'm a newbie

  2. #2
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    957
    Hi,

    Without any files to look at it will be pretty hard to help, advice would be to Google the error messages and work it out from there.

  3. #3
    Registered User
    Join Date
    Apr 2014
    Posts
    2

    Thanks fruitbeard I have been research non stop for days tried so many things

    Quote Originally Posted by fruitbeard View Post
    Hi,

    Without any files to look at it will be pretty hard to help, advice would be to Google the error messages and work it out from there.
    I tried to attach a file but it wont work

  4. #4
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    Not sure if this is the problem, but I'll point out some things that could be it (I'll take as an example the "Teap" part, though you'll have to apply it to the rest of them).
    - First, you're assigning an eventListener to a "Teap" you didn't define previously. You have to write, for example, var teap:Teap = new Teap(); and then you can go on and add a listener to it.
    - Second, you're writing "Teap" with a capital T. As far as I understand you only use capitals when you're referencing the class itself, for example if you say teap = new Teap(); notice that the first teap (which is a variable name) starts with a lower case letter, and the class starts with a capital letter. Therefore, you should not write Teap.addEventListener(MouseEvent.CLICK, clickdresses); but make a variable called "teap" (as said before) and then teap.addEventListener(MouseEvent.CLICK, clickdresses);.

    Hope that helps and it solves your problem!
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width


HTML5 Development Center

Poll by Flashkit.com