MultiScaleContainer Viewport Properties Bug
I'm programing in Flex btw.
So I was looking through the multiScaleContainer code trying to figure out why the zoom property never seemed to be accurate to what zoom level the component was at. I've figured out that the viewPort object (a child of MultiScaleContainer) has a zoom property that does seem to be the zoom level of what the component is at.
When I was looking at the functions for get and set for zoom, scale, and other properties I noticed that there is a commented out note that says //FIXME... implying to me that you haven't implemented the fix that will update these values automatically.
My questions are twofold:
1) I've noticed a that you don't put a ';' character at the end of your lines. I'm not sure if this is a habit from starting out programming actionscript in Flash but I found it a bit confusing, because I always end my code lines with a ';' to mark the end of the line. I then noticed that you have code like such:
//----------------------------------
// zoom
//----------------------------------
private var _zoom:Number
private var zoomChanged:Boolean = false
;[Bindable(event="transformUpdate")]
// FIXME
/**
* @copy org.openzoom.flash.viewport.IViewport#zoom
*/
public function get zoom():Number
{
return _zoom
}
public function set zoom(value:Number):void
{
if (_zoom != value)
{
_zoom = value
zoomChanged = true
invalidateProperties()
}
}
//----------------
Does the ';' before the [Bindable(event="transformUpdate")] mean or do anything? Does it essentially comment the event out? I can tell you are trying to get the zoom values to update automatically when the transformUpdate event is triggered (presumably by the viewPort component) but it doesn't seem to be working yet. What exactly needs to be fixed? This brings me to my next question:
2) I can see from browsing your code that you do a lot of event declaring before get/set functions. Does this mean that the event will get triggered if the get/set functions are run. It seemed like your code in the NormalizedViewport class was doing that but the code above seems to be an attempt to catch the event, not dispatch it. Am I off base here, or have you just not implemented the code to catch the zoom value from the viewPort yet? Is there somewhere I can go to try to better understand these "Bindable Getter/Setter' events? I was looking through the flex documentation but couldn't find it.
The whole reason I was doing this was to try and create an event that got dispatched on the component when the zoom level changed so I could see what the zoom level was at? I managed to do this by making a zoomEvent dispatched from the viewport, caught by the multiScaleContainer and then dispatched from there to the next parent. (I was going to use the bubbles variable but it seemed like the constraints weren't being acknowledged in the viewPort component and thus the viewPort.zoom property could be off when a zoom was first changed. I was doing this to try and understand the size of sprites with regards to the sceneHeight and sceneWidth properties and the zoom property.
Hopefully this isn't too detailed. Thanks a lot : )
So I was looking through the multiScaleContainer code trying to figure out why the zoom property never seemed to be accurate to what zoom level the component was at. I've figured out that the viewPort object (a child of MultiScaleContainer) has a zoom property that does seem to be the zoom level of what the component is at.
When I was looking at the functions for get and set for zoom, scale, and other properties I noticed that there is a commented out note that says //FIXME... implying to me that you haven't implemented the fix that will update these values automatically.
My questions are twofold:
1) I've noticed a that you don't put a ';' character at the end of your lines. I'm not sure if this is a habit from starting out programming actionscript in Flash but I found it a bit confusing, because I always end my code lines with a ';' to mark the end of the line. I then noticed that you have code like such:
//----------------------------------
// zoom
//----------------------------------
private var _zoom:Number
private var zoomChanged:Boolean = false
;[Bindable(event="transformUpdate")]
// FIXME
/**
* @copy org.openzoom.flash.viewport.IViewport#zoom
*/
public function get zoom():Number
{
return _zoom
}
public function set zoom(value:Number):void
{
if (_zoom != value)
{
_zoom = value
zoomChanged = true
invalidateProperties()
}
}
//----------------
Does the ';' before the [Bindable(event="transformUpdate")] mean or do anything? Does it essentially comment the event out? I can tell you are trying to get the zoom values to update automatically when the transformUpdate event is triggered (presumably by the viewPort component) but it doesn't seem to be working yet. What exactly needs to be fixed? This brings me to my next question:
2) I can see from browsing your code that you do a lot of event declaring before get/set functions. Does this mean that the event will get triggered if the get/set functions are run. It seemed like your code in the NormalizedViewport class was doing that but the code above seems to be an attempt to catch the event, not dispatch it. Am I off base here, or have you just not implemented the code to catch the zoom value from the viewPort yet? Is there somewhere I can go to try to better understand these "Bindable Getter/Setter' events? I was looking through the flex documentation but couldn't find it.
The whole reason I was doing this was to try and create an event that got dispatched on the component when the zoom level changed so I could see what the zoom level was at? I managed to do this by making a zoomEvent dispatched from the viewport, caught by the multiScaleContainer and then dispatched from there to the next parent. (I was going to use the bubbles variable but it seemed like the constraints weren't being acknowledged in the viewPort component and thus the viewPort.zoom property could be off when a zoom was first changed. I was doing this to try and understand the size of sprites with regards to the sceneHeight and sceneWidth properties and the zoom property.
Hopefully this isn't too detailed. Thanks a lot : )
2
people have this problem
I have this problem, too!
Tell me when someone solves it.
The more people who report this problem, the more it gets noticed.
The more people who report this problem, the more it gets noticed.
The company has acknowledged this problem.
-
Inappropriate?Ok so after doing a little more research about these Bindable Getters/Setters it seems like the [Bindable(event)] tags are more set up so that if someone is using the value as a binded property then it will actually get updated when the value is changed. That being said, it doesn't really answer my question as to what needs to be fixed in order to get those properties to update. Would there just need to be an event listener for when the viewPort zoom value gets changed that dispatches to the MultiScaleContainer and then updates it? I want to know both for my Flex knowledge and so that I can hopefully improve the component.
For anyone wanting to read up on Bindable Getters/Setters, try reading this: http://www.deitte.com/archives/2009/0... -
Inappropriate?Upon further experimentation / research / realization it would seem that in order to get the values to update properly, we would want to modify the following function:
private function viewport_transformUpdateHandler(event:ViewportEvent):void
to have code inside of it like:
this.zoom = viewport.zoom;
dispatchEvent(new ViewportEvent(ViewportEvent.TRANSFORM_UPDATE));
That being said, I think I may have figured out why you don't do that. It seems to slow the component down and make the zooming a lot choppier than it was before I added that code block. So I'm assuming you didn't add it because you didn't want to affect the component's performance? Couldn't you just bind the zoom, scale, and other properties of the viewPort to the properties on the multiScaleContainer component? (is that even possible?)
Another solution I was toying with was adding a timer that trigered the code block after .3 seconds or something but if it was still zooming (or the transformUpdate handler was called again) then it reset the timer. At this point I'm not even quite sure how useful this is but it was just some thoughts. -
Inappropriate?Batkins,
I'll have to keep it short but basically the properties that are mapped from the viewport to the MultiScaleImage component don't work. Simply use the properties on viewport directly and you should be fine. If you find out how to map those properties while getting data binding to work, please let me know ;)
As for the missing semicolons, the reason I don't use them is because we don't need them. Apart from that I try follow the excellent Flex SDK coding conventions. I'm a big fan of Python's syntax which even gets rid of curly braces. It teaches us that everything superfluous such as curly braces and semicolons in source code are noise. However, since the Flex compiler stumbles around missing semicolons before [Metadata] I put them in front of the metadata to appease the compiler.
Cheers,
Daniel
The company says
this solves the problem
Loading Profile...




EMPLOYEE