Jump to content
Search Community

Feature request - manual bg rect override

Sam test
Moderator Tag

Recommended Posts

Hi Jack,

 

I'd like to make a feature request for the FlexContentDisplay & ContentDisplay classes. In your _update call you are drawing a, normally transparent, rectangle:

		protected function _update():void {
		var left:Number = (_centerRegistration && _fitWidth > 0) ? _fitWidth / -2 : 0;
		var top:Number = (_centerRegistration && _fitHeight > 0) ? _fitHeight / -2 : 0;
		graphics.clear();
		if (_fitWidth > 0 && _fitHeight > 0) {
			graphics.beginFill(_bgColor, _bgAlpha);
			graphics.drawRect(left, top, _fitWidth, _fitHeight);
			graphics.endFill();
		}

I remember something from the docs about this being to insure mouse interactions would function properly. My request is to have a var that tells it *not* to do this. I would like to draw these backgrounds myself but updates were interfering. I extended the class but it sure would be nice to not have to check/maintain it each time I update my greensock. My thoughts are something like:

		protected function _update():void {
		var left:Number = (_centerRegistration && _fitWidth > 0) ? _fitWidth / -2 : 0;
		var top:Number = (_centerRegistration && _fitHeight > 0) ? _fitHeight / -2 : 0;
		if ( !manualBg )
		{
			graphics.clear();
			if (_fitWidth > 0 && _fitHeight > 0) {
				graphics.beginFill(_bgColor, _bgAlpha);
				graphics.drawRect(left, top, _fitWidth, _fitHeight);
				graphics.endFill();
			}
		}

With the appropriate getters and setters for manualBg. I can pass along what I have done if you like but I assume you'd like to do it your own way.

 

Thanks!

Sam

Link to comment
Share on other sites

Hey Sam. I'm a little reluctant to add that sort of feature because I just don't think it would get used by even 1% of the audience and it would impose a file size and API cost, plus you can already accomplish your goal using different methods. Two ideas that come to mind:

 

1) Extend ContentDisplay/FlexContentDisplay, add your functionality, and then set the LoaderMax.contentDisplayClass to your new class.

 

2) Don't draw on the graphics layer inside the ContentDisplay - instead, either nest it inside another Sprite in which you draw your graphics or nest a Sprite inside the ContentDisplay to draw your graphics (depending on the stacking order you want).

 

How does that strike you?

Link to comment
Share on other sites

Couldn't hurt to ask. I am doing option 1 but I have to completely override the _update call so I am essentially copying that function and then removing that piece. A little easier than merging but still with the some maintenance concerns. #2 is undesirable for a slew of reasons that are unique to my situation.

 

Anyhow, thanks for the fast reply.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...