Author Topic: how to make object to be drawn when conditions are meet?  (Read 6118 times)

lookang

  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
how to make object to be drawn when conditions are meet?
« on: September 18, 2008, 03:50:57 pm »
ElementsParticle
Particle: An interactive particle.

http://www.um.es/fem/EjsWiki/index.php/Main/ElementsParticle

i was reading this but i can't get a feel of how to solve this problem i have.

when
mode.equals("edit_v-t_graph")

i want to draw ParticleSet_movable

else

don't draw this object.

how do i program it ?


currently i can achieve visibility state  "False"but because i also have codes in On Drag property
dsnap();
dragvt()

so the objects interact with user despite being not visible. :(
« Last Edit: September 18, 2008, 03:52:43 pm by lookang »

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: how to make object to be drawn when conditions are meet?
« Reply #1 on: September 18, 2008, 04:46:01 pm »
You can set Visible property to mode.equals("edit_v-t_graph") if you want it to be drawn on the condition that mode.equals("edit_v-t_graph") is true.

You can only drag an object when it is visible. (Unless you draw the object the same color as the background-- the object was draw but user might not be able to see it. this is different case)

Is this what you want?

lookang

  • Hero Member
  • *****
  • Posts: 1772
  • http://weelookang.blogspot.com
    • lookang web
Re: how to make object to be drawn when conditions are meet?
« Reply #2 on: September 18, 2008, 05:35:01 pm »
only after posting n reading ur post then i understand in the xml there are 2 set of objects drawing in the v-t graph.
this is important quote"You can only drag an object when it is visible. "

one is the set of ParticleSet_movable2 | visible mode.equals("edit_v-t_graph") | OnDrag dragvt();
dsnap(); |
other one  is the Polygon_line_during_edit_options | visible mode.equals("edit_v-t_graph") | OnDrag dragvt();

what i did that i think achieve what i want is to create another object called Polygon_line_for_non_edit_options | mode.equals("simple_acceleration")||mode.equals("uniform_motion")||mode.equals("simple_deceleration")||mode.equals("rise_and_fall")||mode.equals("fall_and_rebounce") |  DragOn  "BLANK" !!!!

done!!!

yes you r right, i will try to rearrange the simulation vertical from current horizontal ASAP :)

Thanks!
« Last Edit: September 18, 2008, 05:38:21 pm by lookang »