I'm trying to play with the sample IR code and not getting very far. What I would like to do is change the ImageResource associated with an ImageDrawable, and in turn associated with a Trackable2DObject. - in response to user action at runtime. I can't really statically define these.
What is the approved approach to doing this? Is it possible to reach in and change this constructor parameter at runtime (I'm somehow doubting it)? Can you change the ImageResource assocated with an ImageDrawable? Is there some other way?
Thanks
F
Fred
said
over 10 years ago
Hmm, obviously nobody else has had to change an image at runtime then - strange, I would have thought it was a common requirement.
W
Wolfgang Damm
said
over 10 years ago
Hi,
it is possible to change the ImageResource of an ImageDrawable after it was created.
e.g.
var imageDrawable = new AR.ImageDrawable(imageResourceOld, 5); ... imageDrawable.imageResource = imageResourceNew;
Addtionally if you want to position the drawable differently you might prefere creating 2 imageDrawables and setting disabling one. If the user clicks you can enable the 2nd and disable the first. Use
Fred