rollover - How can I dynamically change the image in an Edge Animate symbol? -


i'm working on site prototype has many rollover images in navigation. each image unique, rollover , rollout code identical. i'm trying create single symbol can used of rollovers, need figuring out, speed work.

i think pseudocode work this

  1. create symbol contains default rollover image.
  2. in symbol, add rollover , rollout code. adjusts transparency 0 -> 100 , back.
  3. create instances of symbol on each item in nav.
  4. for each instance, set variable containing name of rollover image used.
  5. in symbol instance, variable value.
  6. in symbol instance, use image name in variable replace default image.

question: how make step 4-6 work? have 1-3 working smoothly.


update: have #6 solved

images managed css background-image property rather old-school <img src=...>. set image element, syntax is:

$(sym.lookupselector("[elementname]")).css('background-image', [image]); 

and there's second part, getting [image] right.

  1. use default relative url edge images: images/[image]
  2. use standard syntax css background-image: url(images/[image])

p.s. last dev work waaaaay director, php , coldfusion. still basic principles such using functions, objects, instances, inheritance etc, language has changed. , have very little experience dom.


appendix: how i'm doing manually

  1. there's background image of nav showing of unselected states

  2. each item in nav has corresponding rollover image, in series of elements layered on top of nav element. each rollover has opacity set 0%.

  3. each image element has rollover, rollout , click triggers. rollover , rollout triggers identical each. there's little more code rollout provides quick fade. means lots of copying identical code. hate think having change part of code.

i came same conclusions yours.

steps 4-5 did way: when create symbol instance give special name, "button_image1". in code can check property doing:

var symbolelement = sym.getsymbolelement(); var id = symbolelement.attr("id") var tokens = id.split("_"); var image = tokens[1]; 

and set right image background.

you can put code on creation_complete event of symbol.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -