I can't visualize what you want this to do. Can you please describe in more detail?
So you want to replace the selected line with an image(for example a wall image) when you click on a button?
Hi Greg and Yennick,
Yes thats exactly what I want to do. I think Adobe illustrator can do the same behaviour, whereby you draw a line
with the pen tool and then have the option to apply a graphic to the line, so the line will turn into the applied graphic.
The line can be any shape and can be freehand as well.
You could get the coordinates of the line as to know were to place the image.
Create an Image object, set its properties (x,y,width,height,source etc). You can strech the image to match the size of the line.
Remove the line or just hide it.
Add the Image to the stage.
If the aspectRatio is not important (like for an image that can be repeated horizontally for example), don't forget to set maintainAspectRatio="false" for the image control.
So you actually want to texture a line which is already drawn and which can have any form.
I've never done this before, but I've looked at the Graphics class a bit and maybe you can do the following:
1. remember the lines/curves you've drawn for every line shape.
2. use the Graphics.lineBitmapStyle method to set the image you want to use as a texture.
3. use the Graphics.drawPath method to redraw the line graphic again with the lines/curves you saved for the already drawn line shape. This should now show a textured line.
4. use the Graphics.clear method on the old line shape to remove the old line.
see livedocs page for more info about the Graphics class http://livedocs.adobe.com/flex/3/langref/flash/display/Graphics.html
Hope this helps.