[flexcoders] Re: how to draw over an image

2007-01-17 Thread dodger6135396
--- In flexcoders@yahoogroups.com, dodger6135396 [EMAIL PROTECTED]
wrote:

 Using ActionScript3.0 and Flex2.0.1 I want to display an image
 /photograph. Then I want to draw shapes on top of this image, but I
 dont want to alter the image. For example the  image would be located
 at x=0, y=0, width = 320 and height = 240, then at a Z order higher
 above the image a transparent something located at the same
 coordinates would allow the user to highlight parts of the image.
 Please is this even possible?. Is there a technique for doing this?.
 
 Thanks in anticipation.

Ok thanks for your help I am now able to create highlights except that
the highlight gets hidden beneath the Image object I am trying to
highlight how do I bring the highlights into the foreground ?. The
order of objects is Application-Panel-HBox-VBox-Panel-Image.



[flexcoders] Re: how to draw over an image

2007-01-12 Thread patricklemiuex
Quite simply you can create a VBox, HBox or Canvas, add a SWFloader
then add a UIcomponent to draw what you want, stacking order is all
based on adding Children to the display object. Here's a sample of
some code I used to add a horizontal Gradient Bar inside and HBox for
a poll and quiz app... I hope this helps you out.

Patrick




var myUIComponent:UIComponent = new UIComponent;
tileHolder.addChild(myUIComponent);
var colors:Array = [0xFEAF39,0xFF9900];
var barHeight:Number = 25;
var barWidth:Number = 270;

if (leftMove==true) imageHolder.width = 0;
if (leftMove!=true) barWidth = (barWidth - 
imageHolder.width);

textHolder.width = barWidth;
textHolder.maxWidth = barWidth;

if (yesno==true) colors = [0xBD0202,0xFF];
if ((yesno==true)(i%2!=1)) colors = 
[0x009900,0x00FF00];

if (quiz==true) colors = [0xBD0202,0xFF];
if ((quiz==true)(setCorrect==true)) colors = 
[0x009900,0x00FF00]; 

var _backSprite:Sprite = new Sprite();
var matrix:Matrix = new Matrix();


matrix.createGradientBox(barWidth,barHeight,0,0,0);

var alphasGrey:Array = [10,10];
var ratiosGrey:Array = [0x00,0xFF];
var colorsGrey:Array = [0xCC,0x66]; 
_backSprite.graphics.lineStyle();

_backSprite.graphics.beginGradientFill(GradientType.LINEAR,colorsGrey,alphas,ratiosGrey,matrix);

_backSprite.graphics.drawRect(0,0,barWidth,barHeight+2);
_backSprite.graphics.endFill();
_backSprite.alpha=.2;

--- In flexcoders@yahoogroups.com, dodger6135396 [EMAIL PROTECTED]
wrote:

 Using ActionScript3.0 and Flex2.0.1 I want to display an image
 /photograph. Then I want to draw shapes on top of this image, but I
 dont want to alter the image. For example the  image would be located
 at x=0, y=0, width = 320 and height = 240, then at a Z order higher
 above the image a transparent something located at the same
 coordinates would allow the user to highlight parts of the image.
 Please is this even possible?. Is there a technique for doing this?.
 
 Thanks in anticipation.