Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8547311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:14:22+00:00 2026-06-11T13:14:22+00:00

I’m trying to mix two tutorials in one game. Level 3 is previously used

  • 0

I’m trying to mix two tutorials in one game. Level 3 is previously used in a action script file but I transferred it into a normal AS3 timeline.

I get this error:

ArgumentError: Error #1063: Argument count mismatch on adventure_fla::MainTimeline/newObjects(). Expected 0, got 1.
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.utils::Timer/flash.utils:Timer::tick()

This is the code… sorry if its messy.

    const speed:Number = 5.0;
    var nextObject:Timer;
 // array of objects
    var objects:Array = new Array();

function initGame():void{
player.x=200;
player.y=400;
stage.addEventListener(MouseEvent.MOUSE_MOVE,movePlayer);
Mouse.hide();
player.gotoAndStop("arrow");
setGameTimer();
newObjects();
addEventListener(Event.ENTER_FRAME, moveObject);
}

    function movePlayer(e:MouseEvent):void{

    player.x=mouseX;
    e.updateAfterEvent();}

    function setGameTimer():void {
trace("GAME TIMER STARTED");
var gameTimer:Timer = new Timer(40000, 1);
gameTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endGame);
gameTimer.start()
    }

    function endGame(e:Event):void {
    trace("Game Over");
    // remove all objects
    for (var i:int=objects.length-1; i>=0; i--) {
        removeChild(objects[i]);
        objects.splice(i, 1);
    }  }

    function setNextObject():void {
nextObject = new Timer(1000, 1);
nextObject.addEventListener(TimerEvent.TIMER_COMPLETE, newObjects);
nextObject.start();

    function newObjects():void{
//create next object
        // array of good and bad objects
        var badObjects:Array = ["Bad_1", "Bad_2"]
        var goodObjects:Array = ["Good_1", "Good_2"]
        // create random number
        if (Math.random() < .5 ) {
            //based of treat object length
            var r:int = Math.floor(Math.random()*goodObjects.length);
            // get the treat object by name and cast it as its own class in a temporary variable
            var classRef:Class = getDefinitionByName(goodObjects[r]) as Class;
            // now we can make a new version of the class
            var newObjects:MovieClip = new classRef();
            // dynamic var (because mc is an object) typestr it as good
            newObjects.typestr = "good";
        } else {
            //  for bad same as above
            r = Math.floor(Math.random()*badObjects.length);
            var classRef:Class = getDefinitionByName(badObjects[r]) as Class;
            var newObjects:MovieClip = new classRef();
            // typestr it bad
            newObjects.typestr = "bad";
        }
        // random pos
        newObjects.x = Math.random()* 500;
        newObjects.scaleX = newObjects.scaleY = .4;
        addChild(newObjects);
        // push it to array
        objects.push(newObjects);
        // create another one
        setNextObject();

    }

     function moveObject(e:Event):void {
    // cycle thru objects using a for loop
    for (var i:int=objects.length-1; i>=0; i--) {
        //move objects down based on speed
        objects[i].y += speed;
        objects[i].rotation += speed;
        // if objects leaves the stage
        if (objects[i].y > 400) {

            removeChild(objects[i]);

            objects.splice(i, 1);

        }
    }
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:14:23+00:00Added an answer on June 11, 2026 at 1:14 pm

    newObjects does not take any arguments, but it’s used as an event listener (which requires it to take the event object).

    It should probably look something like function newObjects(event:TimerEvent):void.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to render a haml file in a javascript response like so:
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.