Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-03-2006, 06:59 PM   #1
tgf
Registered User
 
Join Date: Oct 2006
Posts: 1
Question drawing on a canvas object

Hi there,

I have a question about the canvas object in flex 2.
I've created a canvas, and I'm placing gifs on it with the addChildren method. The user can drag the gifs around the canvas area, and if she moves them off the right edge or the bottom edge, scrollbars appear.

I want there to be lines connecting these gifs, so I'm currently drawing them using something like:

ActionScript Code:
graphics.clear(); canvas1.graphics.lineStyle(1,0x000fff,0.3); for each(var l:line in lines){     canvas1.graphics.moveTo(l.x1, l.y1);     canvas1.graphics.lineTo(l.x2, l.y2); }

Now here's my problem:
Every time I move a gif off of the canvas (i.e. the scrollbars appear) the lines stay static on the screen. They don't respond to the movement of the view of the canvas at all.

Any ideas?

Last edited by dr_zeus; 03-17-2008 at 08:46 PM. Reason: please use [as][/as] formatting tags
tgf is offline   Reply With Quote
Old 10-04-2006, 10:09 PM   #2
nirth
Member
 
Join Date: May 2006
Posts: 46
Send a message via ICQ to nirth Send a message via AIM to nirth Send a message via MSN to nirth Send a message via Yahoo to nirth Send a message via Skype™ to nirth
Default

Well, there are 2 ways
1) redraw stuff on scroll events
2) make component from UIComponent (or any other container, but set it properties to show all content, and do not show scrollbars), do all drawing there, and add your component to canvas.
__________________
OrangeBlog finally in english, but really bad one
nirth is offline   Reply With Quote
Old 03-17-2008, 06:59 PM   #3
sivakishore
Registered User
 
Join Date: Mar 2008
Posts: 1
Post connector between the components in canvas

Hi,
I am on the same line with panels in canvas to be connected and the connection should stay when user drags the panel. Can any one help me out. plz
sivakishore is offline   Reply With Quote
Old 10-21-2008, 05:55 PM   #4
arasgadl
Registered User
 
Join Date: Oct 2008
Posts: 1
Talking

Hi.

I solve this problem, I put this function in application creationcomplete event and scroll canvas' event

Quote:
private function dibujaMalla():void {
var despY:int=canvas1.verticalScrollPosition; //just up and down
//var desX:int=canvas1.horizontalScrollPosition; //not at the moment

canvas1.graphics.clear(); //clean any graphics in the canvas
canvas1.graphics.lineStyle(1,0x000fff,0.7);

//vertical lines
for (var y:int=5;y<ANCHO_CANVAS;y+=164) {//each 164 points a line
canvas1.graphics.moveTo(y,0);
canvas1.graphics.lineTo(y,ALTO_CANVAS);
}

//horizontal lines
var x:int=3; //first horizontal line
for (;x<ALTO_CANVAS;x+=40){//each 40 a horizontal line
if (x-despY>0) { //no before 0
canvas1.graphics.moveTo(0,x-despY);
canvas1.graphics.lineTo(ANCHO_CANVAS,x-despY);
}
}

var itamNewHeightCanvas:int=ALTO_CANVAS+despY;
if (itamNewHeightCanvas>x) {//x, next vertical line
var ipos:int=x;
while (ipos<itamNewHeightCanvas) {
canvas1.graphics.moveTo(0,ipos-despY);
canvas1.graphics.lineTo(ANCHO_CANVAS,ipos-despY);
ipos+=40;
}
}
}
arasgadl is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Allways creating 'Drawing Object'... Samuel Flash 8 General Questions 3 07-15-2006 10:26 AM
Declare object from database or stringvariable Web-exxes ActionScript 1.0 (and below) 0 08-02-2005 12:27 PM
Capturing Drawing as a Shared Object eMATHelper ActionScript 1.0 (and below) 0 07-22-2005 07:54 PM
Drawing board: how to deselect pencil? z3r0 ActionScript 1.0 (and below) 1 06-14-2004 02:35 PM
i have a problem with(with()); tost ActionScript 1.0 (and below) 5 10-16-2003 08:00 AM


All times are GMT. The time now is 11:39 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.