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

  • Home
  • SEARCH
  • 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 6728959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:13:54+00:00 2026-05-26T10:13:54+00:00

How would I make an image I load using AS3’s loader class into a

  • 0

How would I make an image I load using AS3’s loader class into a button with an event handler on it? Below is what I have started. And below that is my error I get when I click the message.

AS:

//call function that starts loading my image
callButtons();


function callButtons():void {       
        var spanish_url = root_path + "spanish.png";
        var spanish_loader = new Loader();
        spanish_loader.load (new URLRequest(spanish_url));

//on load complete call the spanishLoaded function

        spanish_loader.contentLoaderInfo.addEventListener (Event.COMPLETE, spanishLoaded);  
}


//add loaded image to my main_container set x,y and turn it into a button. 

    function spanishLoaded (e:Event):void {
        var my_spanish:Loader = Loader(e.target.loader);    
        my_spanish.x = 1062;
        my_spanish.y = 620;
        main_container.addChild(my_spanish);
        my_spanish.addEventListener (MouseEvent.CLICK, playSpanish);
    }

function playSpanish (){

        trace("IN SPANISH");
}

the error I am getting when I click the spanish.png on the stage is: ArgumentError: Error #1063: Argument count mismatch on MyVideoPlayer_CS4_fla::MainTimeline/playSpanish(). Expected 0, got 1.

I NEEDED TO ADDED evt:MouseEvent

  • 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-05-26T10:13:55+00:00Added an answer on May 26, 2026 at 10:13 am

    In your function spanishLoaded you add an event listener:

    my_spanish.addEventListener (MouseEvent.CLICK, playSpanish);
    

    playSpanish function will expect a mouse event:

    You have:

    function playSpanish ()
    

    This should be:

    function playSpanish (event:MouseEvent)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started looking into using Modules in Flex and would like to
I would like to make a image randomizer/slider that randomly displays an image from
I edited the question so it would make more sense. I have a function
I have a C++ app and looking for a library that would make it
I have an xml image bank, pretty standard, and I have a loader, along
I would like to load images into a gallery view from a url? I
I'm wondering if anyone using Jcarousel would have a suggestion on how to clone
i would like to load 3 images in a canvas. I'm using jquery mobile
What would make development with SharePoint easier?
I would make to make a small WYSIWYG editor similar to the one used

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.