Thanks for tips!
1. Have tried setting vScrollPolicy to "off" with the result being less than satisfactory; despite clipContent being set to "on" if vScrollPolicy && hScrollPolicy are set to "off" the SWF loaded within the Canvas gets repainted beyond the boundaries of the Canvas. Yep... weird.
2. As to dragging, I do it more or less this way:
-----------------------------------------------------------------------------------------------------
// Check whether this is an event affecting the Canvas.
function handleCanvasEvent():Boolean {
if (canvas1.mouseX>=0 && canvas1.mouseX<=(canvas1.width-20) &&
canvas1.mouseY>=0 && canvas1.mouseY<=(canvas1.height-20)) {
return true;
} else {
return false;
}
}
// Detect mouse down and whether this event should be handled for dragging.
function handleMouseDownSomewhere(event) {
if (handleCanvasEvent()) {
mouseDownX = canvas1.mouseX;
mouseDownY = canvas1.mouseY;
currentX = layerCanvas.x;
currentY = layerCanvas.y;
}
}
// Handle events for "life" dragging.
function handleMouseMoveSomewhere(event) {
if (handleCanvasEvent()) {
layerCanvas.x = currentX+(canvas1.mouseX-mouseDownX);
layerCanvas.y = currentY+(canvas1.mouseY-mouseDownY);
}
}
-----------------------------------------------------------------------------------------------------
I'm sure there must be more elegant ways to produce similar effects... this works with the aforementioned unsavoury side-effects.
3. Tried it... has improved performance somewhat. Can this reduction in rendering quality be applied to specific contains or always at a global level?
Salutacions - Un Saludo - Regards,
Carlos Lozano Diez
Quavantis
"JesterXL" <[EMAIL PROTECTED]>
Sent by: flexcoders@yahoogroups.com 16/04/2005 19:25
|
|
I can tackle 1 one those, the rest are juts inferences:
1. not sure; try setting the v and hScrollPolicy = "off" before you drag.
2. How are you dragging it?
3. Yep! Don't know if this is Flex documented :: takes 2 millisecond look
:: Weird, don't see it. Anyway, do 2 things:
- set your framerate to at least 31 fps, if it's not already
- try setting _quality = "LOW"; _quality should be global and the compiler
shouldn't whine :: tests :: ah, cool, it works here. Ok, set it to "LOW"
when you drag, and change it back to "HIGH" when your done.
----- Original Message -----
From: "carloslozanodiez" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Saturday, April 16, 2005 1:02 PM
Subject: [flexcoders] Drag/Pan/Zoom HOWTO-do it better?
Hi all,
I've loaded a SWF map into a mx:Canvas (Flex 1.5) and need advice as
to how to tackle the following problems:
- When zooming/scaling the map the mx:Canvas scrollbars (always set
to on) are not behaving properly (sometimes not reflecting the
change in the scale of the content and sometimes disappearing
altogether). Any pointers as to how I can get the mx:Canvas
scrollbars to behave correctly/consistently?
- When moving the map around in the mx:Canvas using the scrollbars
the movement is jerky and slow. Any tips/samples on how I can
improve the behavior?
- When dragging the map with the mouse clicked down the movement is
jerky and slow at best. Does anyone have any tips/samples as to how
to optimise this type of functionality? Is there a means to reduce
the rendering quality of the SWF displayed within the Canvas to low
while dragging to mitigate the effects of this problem?
I'm a Java coder and still getting to grips with mxml and
as2 "tricks". Any tips/hints/pointers/samples much appreciated.
Thanks,
Carlos Lozano
Quavantis
Yahoo! Groups Links
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.