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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:17:56+00:00 2026-05-10T18:17:56+00:00

What is the best way to create several scrollable regions in an ActionScript 3

  • 0

What is the best way to create several scrollable regions in an ActionScript 3 visualization that extends flash.display.Sprite and makes use of hierarchy of of low level DisplayObjects (Sprite’a, Shape’s, TextField)?

I have tried to use three mx.containers.Canvas objects added as children of the main Sprite and have also tried converting the main Sprite to a Canvas but am unable to get anything to show up using either method. I have also tried adding my DisplayObjects using both Canvas.addChild and Canvas.rawChildren.addChild.

Is it necessary/possible to rewrite the whole thing to use mx.* components or is there a trick to displaying more primitive objects inside of a Canvas object?

Here is some sample code for the way that works using sprites. We would like to make _colSprite, _rowSprite and _mapSprite sroll with linked scrolling bars. When i convert them to Canvas objects the code hangs silently before any display objects are drawn (at the addChild lines if i recall correctly).

Below is an excerpt of the code. This is all from a single actionscript class that extends sprite.

Seting up three regions i wish to scroll:

this._log('Creating Sprites');                   this._colSprite = new Sprite();                  this._colSprite.y=0;                  this._colSprite.x=this._rowLabelWidth + this._rowLabelRightPadding + this._horizontalPadding;   this._rowSprite = new Sprite();                  this._rowSprite.y=this._columnLabelHeight+this._columnLabelBottomPadding + this._verticalPadding;                  this._rowSprite.x=this._horizontalPadding;                     this._mapSprite = new Sprite();                  this._mapSprite.y=this._columnLabelHeight+this._columnLabelBottomPadding+ this._verticalPadding;                  this._mapSprite.x=this._rowLabelWidth + this._rowLabelRightPadding+this._horizontalPadding;                       this._log('adding kids');   addChild(this._mapSprite);  addChild(this._rowSprite);  addChild(this._colSprite); 

Sample drawing function:

 private function _drawColumLabels(colStartIndex: int): void {          for (var col : int = colStartIndex; col < myData.g.length; col++) {              var colName : String = this.myData.g[col].label;              var bottomLeftPoint : Object = this._getCellXYTopLeft(0, col);              bottomLeftPoint.y = this._columnLabelHeight + this._verticalPadding;              var centerX : int = Math.round(this._cellWidth / 2 + (this._fontHeight / 2) - 1);                var colLabel : TextField = new TextField();                  colLabel.defaultTextFormat = this._labelTextFormat;                  colLabel.width = this._columnLabelHeight+this._columnLabelBottomPadding;                  colLabel.text = colName;                                  colLabel.embedFonts = true;                      var colSprite : Sprite = new Sprite();                  colSprite.addChild(colLabel);                  colSprite.x = bottomLeftPoint.x;                  colSprite.y = bottomLeftPoint.y;                    colSprite.rotation = -45;                    this._colSprite.addChild(colSprite);            }      } 
  • 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. 2026-05-10T18:17:57+00:00Added an answer on May 10, 2026 at 6:17 pm

    After adding the children to each Canvas you may need to call Canvas.invalidateSize() (on each one) to get them to recalculate their sizing.

    Needing to do this depends on which stage in the Component Lifecycle you’re adding the children – i.e. when you’re calling ‘_drawColumLabels’.

    I presume you’re wanting a scollbar to appear on _colSprite (and _rowSprite) if there are more labels in it than can be displayed in it’s visible area? If this is the case you’ll need to use something other than Sprite, like Canvas as Sprite doesn’t support scrolling.

    You may also want to debug the x/y/width/height values of each of your components to make sure they’re what you expect – something I find helpful with doing layout is to draw the layout on paper and start writing sizes and coordinates so that I can see that my calculations are right.

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

Sidebar

Ask A Question

Stats

  • Questions 123k
  • Answers 123k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It gets cleared whenever the computer gets "cleaned up". This… May 12, 2026 at 1:12 am
  • Editorial Team
    Editorial Team added an answer It seems like the administration kept for memory allocation has… May 12, 2026 at 1:12 am
  • Editorial Team
    Editorial Team added an answer Just do a regular get, then run something like ATTRIB… May 12, 2026 at 1:12 am

Related Questions

So right now i need to create and implement an extension of the Python
I am building a site that is an interface used to create XML files
I have several static factory patterns in my PHP library. However, memory footprint is
I've got code similar to the following... <p><label>Do you have buffet facilities?</label> <asp:RadioButtonList ID=blnBuffetMealFacilities:chk

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.