
|
If you were logged in you would be able to see more operations.
|
|
|
Flash Player
Created: 04/15/08 06:10 PM
Updated: 04/30/08 02:24 PM
|
|
| Component/s: |
Text Layout
|
|
Security Level:
|
Public
(All JIRA Users
)
|
|
| Severity: |
Incorrectly Functioning with Workaround
|
| Discoverability: |
High
|
| Found in Version: |
FP 9.2 - Code Complete
|
| Affected OS(s): |
Windows
- All Windows
|
| Steps to Reproduce: |
Steps to reproduce:
1. Create a DisplayObject instance.
2. Draw something in it (with Graphics class for example).
3. Fill it's scrollRect property with a Rectangle that is smaller than the original DisplayObject.
4. Trace the size.
5. Set a little delay with an ENTER_FRAME event or a Timer instance.
6. After this delay you trace the size again.
Actual Results:
The size of the DisplayObject seems uninfluenced the first trace.
But after the delay you see that it suddenly is influenced.
Expected Results:
The size of the DisplayObject should be immidently be cropped / influenced by the scrollRect.
Workaround (if any):
If you want the size of the cropped DisplayObjectyou check the scrollRect properties.
If you want the original size of the DisplayObject you give a extra container the scrollRect and read the DisplayObject his size.
Example code:
package nl.tfw.scrollrect
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.geom.Rectangle;
import flash.display.Shape;
public class ScrollRectTester extends Sprite
{
private var _contentContainer:Sprite;
private var _block:Shape;
public function ScrollRectTester()
{
_contentContainer = new Sprite();
_block = new Shape();
_block.graphics.beginFill(0x0066ff);
_block.graphics.drawRoundRect(0,0,200,100,5,5);
_contentContainer.addChild(_block);
addChild(_contentContainer);
trace(" org contentWidth: "+_contentContainer.width); // -> 200
_contentContainer.scrollRect = new Rectangle(0,0,75,75);
trace(" contentWidth: "+_contentContainer.width); // -> 200
var timer:Timer = new Timer(1000,0);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
private function onTimer(event:TimerEvent):void
{
trace(" contentWidth: "+_contentContainer.width); // -> 75
trace(" _block.width: "+_block.width); // -> 200
}
}
}
Steps to reproduce:
1. Create a DisplayObject instance.
2. Draw something in it (with Graphics class for example).
3. Fill it's scrollRect property with a Rectangle that is smaller than the original DisplayObject.
4. Trace the size.
5. Set a little delay with an ENTER_FRAME event or a Timer instance.
6. After this delay you trace the size again.
Actual Results:
The size of the DisplayObject seems uninfluenced the first trace.
But after the delay you see that it suddenly is influenced.
Expected Results:
The size of the DisplayObject should be immidently be cropped / influenced by the scrollRect.
Workaround (if any):
If you want the size of the cropped DisplayObjectyou check the scrollRect properties.
If you want the original size of the DisplayObject you give a extra container the scrollRect and read the DisplayObject his size.
Example code:
package nl.tfw.scrollrect
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.geom.Rectangle;
import flash.display.Shape;
public class ScrollRectTester extends Sprite
{
private var _contentContainer:Sprite;
private var _block:Shape;
public function ScrollRectTester()
{
_contentContainer = new Sprite();
_block = new Shape();
_block.graphics.beginFill(0x0066ff);
_block.graphics.drawRoundRect(0,0,200,100,5,5);
_contentContainer.addChild(_block);
addChild(_contentContainer);
trace(" org contentWidth: "+_contentContainer.width); // -> 200
_contentContainer.scrollRect = new Rectangle(0,0,75,75);
trace(" contentWidth: "+_contentContainer.width); // -> 200
var timer:Timer = new Timer(1000,0);
timer.addEventListener(TimerEvent.TIMER, onTimer);
timer.start();
}
private function onTimer(event:TimerEvent):void
{
trace(" contentWidth: "+_contentContainer.width); // -> 75
trace(" _block.width: "+_block.width); // -> 200
}
}
}
|
| Language Found: |
English
|
| Bugbase Id: |
none
|
| Participants: |
Dan Schaffer, Erwin Verdonk and Peter Uithoven
|
|
All
|
Comments
|
|
Sort Order:
|
|
Further to my knowledge the "scrollRect" should never have an influence on the dimension of a DisplayObject. The DisplayObject should always know its own dimension. For the Rectangle dimension you can use DisplayObject.scrollRect.width / DisplayObject.scrollRect.height. When the scrollRect influences the dimension of the DisplayObject we can never get back to its original dimension.
For the record this issue is not the case when using the Flex framework. When using the Flex framework the DisplayObject will always remain having its own dimension next to the dimension of the scroll rectangle, as described in the alinea above.