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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:19:02+00:00 2026-05-19T05:19:02+00:00

I got a factory, where Action Script follows an xml and builds DisplayObject hierarchy

  • 0

I got a factory, where Action Script follows an xml and builds DisplayObject hierarchy out of it. It is meant that script doesn’t know beforehand what elements it will encounter in xml and therefore doesn’t know what user-defined factory classes it will need.

I know that it is possible to do something like this:

var rect:*, className:String = "flash.geom.Rectangle";

if (ApplicationDomain.currentDomain.hasDefinition(className)) {         
    rect = new(getDefinitionByName(className));
}

And Rectangle instance will get instantiated. But as soon as I replace flash.geom.Rectangle with something user-defined, like my.factory.Block it stops working and if I comment out conditional I get simple: “Variable Block is not defined” error.

Obvious workaround would be to create an instance of my.factory.Block (and all other components), prior to activating the factory, but that kinda ruins whole point of dynamic component factory.

Of course I have: import my.factory.*; statement at the top of the script.

Is there any smarter solution to this?

  • 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-19T05:19:03+00:00Added an answer on May 19, 2026 at 5:19 am

    As others have pointed out, the problem is most probably that of classes not being included in the compiled swf. As Daniel pointed out, an import is not enough, you need a reference to the class. You don’t, however, need to declare a variable, as Cay stated, you can just do as follows:

    MyClass;

    Although, if you’re using the mxmlc to compile, you can use the -includes option to specify a class, or classes, that you would like to force to be included in the compiled swf. The nice thing about this is it doesn’t require you to have a reference in your code. It looks like this:

    -includes com.example.MyClass com.example.MyOtherClass

    If you have a really big package of classes you want to include, but don’t want to write out the class name for every class, you can compile the package as a swc, using the compc, and the use the -include-libraries option of mxmlc to include the entire package.

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

Sidebar

Related Questions

I've got a hosted WCF service that I created a custom factory for, so
I've got a chunk of code that looks like this: var task = Task.Factory.StartNew(()
I've got a chunk of code that looks like this: var task = Task.Factory.StartNew(()
I've got a factory class that creates input windows on-the-fly for me. The reason
I've got really simple code: static void Main(string[] args) { var task = Task.Factory.StartNew(GetInt);
I was trying to run a request factory example, but, I got this error
Got a seg fault from my memcpy that gdb can't give me anything else
I got this error: ERROR/MapActivity(258): Couldn't get connection factory client Everything worked fine, it's
I've got a question regarding the difference between PropertyPlaceholderConfigurer (org.springframework.beans.factory.config.PropertyPlaceholderConfigurer) and normal filters defined
i've got 3 Log classes that all implements iLog interface: DatabaseLog FileLog ScreenLog there

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.