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 7063849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:45:44+00:00 2026-05-28T04:45:44+00:00

I have an array of ingredients for soup as strings. These ingredients are also

  • 0

I have an array of ingredients for soup as strings. These ingredients are also movieclips in my library, all linked with an identifier. I want to add the movieclips to the stage dynamically.

I tried getDefinitionByName but I keep getting an error that the variable “appel” (veg[0] in this case) is undefined.
And basically, I only have a general idea what I’m doing here, so I would be grateful if someone could explain it to me or link me to a helpful tutorial.

package  {

import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.utils.getDefinitionByName;

public class groentesoep extends MovieClip {
    const xAr:Array = [13,163,13,26,133,192,169,301,47,313,286,291,163,16];
    const yAr:Array = [12,133,133,370,484,352,256,316,241,160,468,10,53,465];                          
    const veg:Array = ["appel","bloemkool","broccoli","brood","champignons","friet","kaas","melk","paprika","prei","tomaat","ui","vis","wortel"];

    var i:int;

    public function groentesoep() {
        // constructor code
        create_intro();
    }
    public function create_intro () {
        var bord:intro = new intro();
        bord.x = -30;
        bord.y = -6;
        bord.name = "intro";
        addChild(bord);

        var btn:begin = new begin();
        btn.x = 416;
        btn.y = 255;
        btn.name = "beginKnop";
        btn.addEventListener(MouseEvent.CLICK, create_spel);
        addChild(btn);
    }
    public function create_spel(event:MouseEvent) {
        removeChild(getChildByName("intro"));
        getChildByName("beginKnop").removeEventListener(MouseEvent.CLICK, create_spel);
        removeChild(getChildByName("beginKnop"));

        var bord:spel = new spel();
        bord.x = -30;
        bord.y = -6;
        bord.name = "spel";
        addChild(bord);         

        var c:Class = getDefinitionByName(veg[0]) as Class;
        var instance:Object = new c();
        var mc:MovieClip = MovieClip(instance);
        addChild(mc);
    }
}}  

Screenshot of library

  • 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-28T04:45:45+00:00Added an answer on May 28, 2026 at 4:45 am

    When using getDefinitionByName, you always have to explicitly use the classes in your code.
    That means that if you’re using the class which name is defined in veg [0] – “appel” – you have to “force” the compiler to include that class.
    Just wrote at the beginning of your code:

     var dummyAppel:appel;
    

    …and do it for all the classes you want to retrieve by their names.
    Hope it helps

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

Sidebar

Related Questions

I have this ingredients array which contains multiple variables (like name, icon, value etc.).
I have array of strings, String[] data and it's 10 elements has value P
I have array of class Person in ViewModel and I want to show their
I have array of image url. I want to show the images into UIImageView.
I have array like this: $test = array(20, 30, 40); And I want to
I have array A and Array B , I want to get as result
I currently have a ListView that takes in an array of strings. It is
Suppose I have array of points.I want to draw the route of that points
Imagine I have array of values ranging from 1 to 24. I want to
I have array in following format. I want to convert it into another format

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.