Page 1 of 1
How to set location of new object to another but lower!
Posted: Wed Jul 23, 2008 1:33 pm
by heatherbee
This is what I want to do:
When user clicks button, create a new field which appears by fade in under the existing field.
Here's what I have so far (please note, not that I need to point it out, that I am a complete beginner to Rev and to programming in general

):
Code: Select all
on mouseUp
create field "newField"
hide field "newField"
-- to be located first then fade into view
set the location of field "newField" to the location of field "firstField" -- PLUS X OR something to move it under it?!
show field "newField" with visual effect dissolve
end mouseUp
Thanks for helping a n00000bee.

Posted: Wed Jul 23, 2008 2:02 pm
by heatherbee
Okay, I got it working now with the following code, but when the new field is displayed it's briefly visible before it hides. Is there another way to create it invisibly then bring it in with the fade in type effect?
Here's what works for now anyway (no doubt there's a much easier way to do this, like with a function or something and a lot less code, but I haven't learned that far yet!):
Code: Select all
on mouseUp
create field "newField"
hide field "newField"
-- to be located first then fade into view
set the width of field "newField" to 300
set the height of field "newField" to 25
set the location of field "newField" to the location of field "firstField"
move field "newField" relative 0,30 without waiting
show field "newField" with visual effect dissolve
end mouseUp
Thanks in advance for any ideas on how to not have the flashing new field!
Invisible field
Posted: Wed Jul 23, 2008 3:25 pm
by bjb007
Use "create invisible field "newField""
Posted: Wed Jul 23, 2008 3:29 pm
by malte
Hi heatherbee,
welcome to the revolution. If you want to avoid the flicker try locking screen before you create the field.
Code: Select all
on mouseUp
lock screen
create field "newField"
hide field "newField"
-- to be located first then fade into view
set the width of field "newField" to 300
set the height of field "newField" to 25
set the loc of fld "newField" to item 1 of the loc of fld "oldField",item 2 of the loc of fld "oldField" + 30
unlock screen
show field "newField" with visual effect dissolve
end mouseUp
You might also want to look up templateField in the dictionary. If you set properties of the templateField, all newly created fields inherit its properties.
Hope that is any help,
Malte
Posted: Wed Jul 23, 2008 3:29 pm
by Klaus
Hi heatherbee,
you can create an invisible field if you like:
Code: Select all
on mouseUp
create invisible field "newField"
set the width of field "newField" to 300
set the height of field "newField" to 25
## set the location of field "newField" to the location of field "firstField"
## ??? See below...
## move field "newField" relative 0,30 without waiting
## This will not be visible, so what is this good for?
## Maybe you want to set the new loc (y + 30) directly like:
put the loc of fld "firstField" into tNewloc
add 30 to item 2 of tNewloc
set the loc of fld "newfield" to tNewloc
## Now calculate and set the LAYER of the new field:
set the layer of fld "newfield" to (the layer of fld "firstField" - 1)
## Finally show the beast...
show field "newField" with visual effect dissolve
end mouseUp
Done
Hope that helps.
Best from germany
Klaus
Posted: Wed Jul 23, 2008 5:37 pm
by Mark
Hi,
Why so difficult?
Code: Select all
set the loc of fld x to the loc of fld y -- you could take item 2 of the loc if you want
set the top of fld x to the bottom of fld y
Best,
Mark
Posted: Thu Jul 24, 2008 11:15 am
by Klaus
Hmm...
Looks like I misinterpreted "...UNDER the existing field" completely.
In case heatherbee really meant "below"

Posted: Sun Jul 27, 2008 4:44 pm
by heatherbee
OH thanks so much guys! LOL sorry Klaus am 36 and still learning to speak normal Engrishh let alone Revanese!

Mark, sheesh I only started a few days ago so everything is bloomin difficult!
