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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:26:08+00:00 2026-05-19T04:26:08+00:00

For my game, I am making the main game view as a plain Flash/AS3

  • 0

For my game, I am making the main game view as a plain Flash/AS3 class, something like:

public class GameArena extends Sprite

This is simply a big rectangle in which game objects are drawn, so no need for fancy UI and I want to keep the main game engine Flex-free so I can use Sprites rather than heavier Flex components.

However for the entire game/app, I do still want to use Flex for GUI/layout. So I thought I could create a Flex class subclassing UIComponent, which has a GameArena object as a child… now I can use this in MXML as a standard Flex component.

e.g.

    public class ArenaView extends UIComponent 
    {
    public var gameArena:GameArena;
    override protected function createChildren():void
    {
        super.createChildren();
        if (!gameArena)
        {
            gameArena = new GameArena();
            gameArena.width = 200;
            gameArena.height = 200;
            addChild(gameArena);
        }
    }
}

Then I have a simple line in my main App MXML like:

<logic:Arena x="0" y="0" width="50%" height="100%" name="TestArenaPanel" />

But so far while my code compiles, the Flash class isn’t getting rendered. Maybe it’s something simple, but I wanted to ask if this is a reasonable approach, or there is something better?

BTW: I’ve had the “should Flex be used” conversation many times. If you want to discuss that please do so in comments, but keep answers on topic.

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

    You didn’t show us your measure() code, nor updateDisplayList() code of the ArenaView Flex Component. Are you setting the measuredWidth and measuredHeight properties in measure()? Are you positioning and sizing gameArena in updateDisplayList()?

    Remember that the parent is always responsible for sizing and positioning it’s children. I guess that your component is not giving a size to gameArena, effectively making it invisible with a zero width and zero height. Try something like this:

    override protected function upldateDisplayList(unscaledWidth:int, unscaledHeight: int):void{
     super.updateDisplayList(unscaledWidth, unscaledHeight);
     gameArena.setActualSize(unscaledWidth, unscaledHeight);
     gameArea.move(0,0);
    }
    

    That is code I wrote in the browser, but it should be moderately close.

    Many Flex containers will try to position their children, but I don’t think any try to size them if the component has no measuredWidth/measuredHeight propeties set. UIComponent, which you extend, has none of this code.

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

Sidebar

Related Questions

I built a slideshow/decision-making game in Flash but would like to try to redo
Taking this thread to the next level and now making a Main.as class to
I'm making a small game in which the Main class holds all the objects
I'm making this game where I'm trying to pair people. So I have this
I am making a game for my CS class and the sprites I have
I'm making a game in flash, and I want to have a whole bunch
I'm making an iPhone game where the main actor is a ball that rolls
I'm making a 2D game in Java and one of the main issues causing
I want to try making a simple game engine. Just something that handles states,
I am in process of making a small game, where the main Gameplay Layer

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.