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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:18:21+00:00 2026-05-21T18:18:21+00:00

I’ll re-write this question to be clearer. I’m trying to get a class file

  • 0

I’ll re-write this question to be clearer.

I’m trying to get a class file from Flash into Builder.

Everything in that class sits inside a Sprite called mainContainer. Now I’m trying to get that `mainContainer’ which hold the graphics for the class into a Flex Application.

This is proving to be a problem as their are many various ways of doing it (it seems going by numerous Google searches).

First off I declare an MXML Canvas with an Image inside it (as I read would work):

<mx:Canvas x="268" y="10" width="756" height="680" id="canvas">
    <mx:Image id="spriteLayer" x="268" y="0" width="756" height="700" scaleContent="false" autoLoad="true">

    </mx:Image>
</mx:Canvas>}

Ok, my plan was then to pass the Image reference her of spriteLayer to the class I’m trying to run:

            import includes.Spirograph;
            public var spiro:Spirograph = new Spirograph(spriteLayer);

Unfortunately it only ever passes null into the Spirograph class:

        function Spirograph(canvasImage:Image):void
        {   
            this.canvas = canvasImage;
            mainContainer.graphics.beginFill(0xFFFFFF);
            mainContainer.graphics.drawRect(290, 0, 670, 700);
            mainContainer.graphics.endFill();

            ui.addChild(mainContainer);
            canvas.addChild(ui);
}

Not sure what to do.

Many thanks.

  • 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-21T18:18:22+00:00Added an answer on May 21, 2026 at 6:18 pm

    I think you need to read up on the Flex Component LifeCycle. Most likely the spriteLayer component is not yet created or initialized when the new Spirograph(spriteLayer) code called. When is that code called?

    The Flex Component LifeCycle is a series of methods and events that create the Flex UI. You can override these methods, or listen to these events to ‘do stuff’. The canvas and spritelayer will not be created until after the createChildren method is called; and default property values are defined before that happens.

    You could override createChildren() and do the initialization there:

    override protected function createChildren():void{
     super.createChildren()
     spiro  = new Spirograph(spriteLayer);
    }
    

    or you could listen to the initialize event and set the default in there:

    <mx:MyParentComponent initialize="onInitialize()">
     <fx:Script>
       protected function onInitialize():void{
        spiro  = new Spirograph(spriteLayer);
      }
     </fx:Script>
    </mx:MyParentComponent>
    

    As another poster commented, you could also do the initialization (like above) in the creationComplete event, although I would personally recommend against doing that. The creationComplete event dispatches at the very end of the lifecycle; and most likely the changes you’re doing will cause a renderer event to “restart”, forcing most of the lifecycle to parse through again; the component would be resized (measure()) and elements repositioned (updateDisplayList()). Setting default values as early in the lifecycle as possible is recommended.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I want use html5's new tag to play a wav file (currently only supported
That's pretty much it. I'm using Nokogiri to scrape a web page what has
In order to apply a triggered animation to all ToolTip s in my app,
Seemingly simple, but I cannot find anything relevant on the web. What is 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.