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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:31:54+00:00 2026-05-21T19:31:54+00:00

As requested, I’m giving a more detailed description of the problem… First off I

  • 0

As requested, I’m giving a more detailed description of the problem…

First off I have this MXML:

<mx:Panel x="270" y="10" width="690" height="680" id="mainContainerPanel">
    <mx:Canvas x="270" y="10" width="670" height="640" id="canvas" initialize="onInit()">
        <mx:Script>
            protected function onInit():void
            {
                spiro = new Spirograph(canvas);         
            }
        </mx:Script>
    </mx:Canvas>
</mx:Panel>

This passes the tag object to the constructor of my main AS3 class file. This works fine, where in the constructor I have:

function Spirograph(canvas:Canvas):void
{   
    mainContainer = canvas;
    mainContainer.graphics.beginFill(0xFFFFFF);
    mainContainer.graphics.drawRect(0, 0, 670, 640);
    mainContainer.graphics.endFill();
}

At the moment, I am adding all Sprite objects to the mainContainer by using a wrapper class called SpriteUIContainer:

package includes
{
    import flash.display.Sprite;

    import mx.core.UIComponent;

    public class SpriteUIContainer extends UIComponent
    {       
        public function SpriteUIContainer(sprite:Sprite)
        {
            super();
            this.explicitWidth = sprite.width;
            this.explicitHeight = sprite.height;
            this.x = sprite.x;
            this.y = sprite.y;
            addChild(sprite);
        }
    }
}

which is used in the following way:

private var circCentre:Sprite = new Sprite();
circCentre.x = mainContainer.width / 2;
circCentre.y = mainContainer.height / 2;
circCentre.graphics.lineStyle(3, 0xD0B917); 
circCentre.graphics.beginFill(0xF2DF56, 0.2);
circCentre.graphics.drawCircle(20, 20, 50);
circCentre.graphics.endFill();
mainContainer.addChildAt(new SpriteUIContainer(circCentre), 1);

The circCentre Sprite never appears on screen and I don’t understand how I can get it to appear.

Any help much appreciated!

  • 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-21T19:31:55+00:00Added an answer on May 21, 2026 at 7:31 pm

    By ‘attached’ do you mean you are adding new sprites to the UIComponent using the addChild method?

    If so; You’ll have to add code to size and position that new ‘sprite’ relative to the other objects in the container. There is no such code in your example. I recommend implementing this code in updateDisplayList().

    More information on updateDisplayList() is in this Flex Component Lifecycle documentation.

    If you need more help, you’ll have to expand on how your adding new sprites to the UIComponent instance; and perhaps show an example where you add more than one.

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

Sidebar

Related Questions

I have requested the data from our CGI in XML format. I do this
I have requested to fix login problem on the classic asp site. Configuration is
The workflow requested by customer is something like this : The user on registration
We have been requested to stream a single video (+500MB) from a web site.
I have successfully requested to a Basecamp XML file via ajax, but it throws
I have a client who requested piano keys as links and he wants them
My client has requested to enable auto-hyphenation on this page: http://carlosdinizart.com/biography/ , and I
Our product team has requested custom cursors during drag/drop operations. They have provided me
Earlier I requested some feedback on my first F# project. Before closing the question
For example i have requested: WHERE (friend_id=? OR client_id=?) How do i know which

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.