Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 7:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Increase height by X pixels
PostPosted: November 30th, 2004, 5:17 pm 
Offline

Joined: November 3rd, 2004, 2:35 pm
Posts: 117
Location: Swansea, South Wales
Can't seem to find a way in standard actions which seem to only use scale by percentage.

Is there a script function which would do it?

How could I have an object which increases by say 50 pixels every time it was clicked?


For this message leiafee has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 30th, 2004, 5:39 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

The SetObjectSize() function would probably be most suitable for your requirements. Try applying the following script actions to a Left Mouse Click on the object you wish to change:

Code:
width = this.GetWidth()
height = this.GetHeight()
this.SetObjectSize(width,height+50)


This will cause the clicked object to increase in height by 50 pixels every time it is clicked, without affecting the width.

I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 30th, 2004, 5:54 pm 
Offline

Joined: November 3rd, 2004, 2:35 pm
Posts: 117
Location: Swansea, South Wales
Just the job.

Cheers,


For this message leiafee has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 1st, 2004, 2:44 pm 
Offline

Joined: November 3rd, 2004, 2:35 pm
Posts: 117
Location: Swansea, South Wales
An addendum.

Does SetObjectHeight not work in Flex? And is there a possible workaround if it doesn't?


For this message leiafee has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 1st, 2004, 3:30 pm 
Offline

Joined: November 4th, 2004, 11:01 am
Posts: 21
Location: Banbury, UK
try this code instead for flex.

this will change the height by nPixels(in the example it is set to 50 pixels)

Code:
nPixels = 50
displaydata = object.GetDisplayData()
height = (object.GetHeight()*displaydata.scaley)/100
ScaleV = (height+nPixels)/height
object.SetScaleV(ScaleV)


alternatively to change the width by nPixels...

Code:
nPixels = 50
displaydata = object.GetDisplayData()
width = (object.GetWidth()*displaydata.scalex)/100
ScaleH = (width+nPixels)/width
object.SetScaleH(ScaleH)


hope this helps.....

_________________
Alan Dews
Senior Developer
Digital Workshop


For this message Alan Dews has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 2nd, 2004, 10:42 am 
Offline

Joined: November 3rd, 2004, 2:35 pm
Posts: 117
Location: Swansea, South Wales
Almost, but it only works the first time I click it. I need it to work repeatedly.


For this message leiafee has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 2nd, 2004, 11:01 am 
Offline

Joined: November 4th, 2004, 11:01 am
Posts: 21
Location: Banbury, UK
sorry, my mistake - i should try it beyond one step next time.

rather than divide by the current height of the object every time you need to divide by the original height of the object to get the new percentage

here's the corrected code.....

Code:
nPixels = 50
displaydata = object.GetDisplayData()
org_height = object.GetHeight(); //the object's original height
height = (org_height*displaydata.scaley)/100 // calculate the current pixel height
    // the next line is used to calculate the new scale
    // (current height + our pixel change)/original height
ScaleV = (height+nPixels)/org_height
object.SetScaleV(ScaleV)


i'll leave the width one for you to work out yourself should you need it.

_________________
Alan Dews
Senior Developer
Digital Workshop


For this message Alan Dews has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: December 2nd, 2004, 4:31 pm 
Offline

Joined: November 3rd, 2004, 2:35 pm
Posts: 117
Location: Swansea, South Wales
Great, cheers


For this message leiafee has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group