• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Use VML to create reusable graphics

I want to create a small graphic in VML and have that graphic appear several times on a web page but without having to send the VML defintion each time.  I am really concerned about download times, ideally I would like to send the VML definition of the graphic once and then reference that definition with offsets the rest of the time.
0
macgre
Asked:
macgre
  • 4
  • 3
2 Solutions
 
M256Commented:
Hi macgre,

You are of course aware that VML is only for IE.  I assume you know what browser your audience will be using?

Matthew
0
 
M256Commented:
If you really want to use VML, here is a link that should get you started:
http://webfx.eae.net/dhtml/VMLClock/clock.html

Relevant section:
Reusing VML
There are a lot of ways to reuse your VML images. One is to set the src attribute for the xml tag. Another way is to insert it through a scriptlet. When you need to do scripting this is much better because you can remove all the scripting from the current page.


To see the scriptlet method in action, copy and paste this code to your HTML document:
<object type="text/x-scriptlet" data="http://webfx.eae.net/dhtml/VMLClock/clockScriptlet.html"
style="width: 200px; height: 200px;"></object>

Viola!  Instant VML!

Matthew
0
 
macgreAuthor Commented:
I would like to avoid scripting if at all possible.

More practical info on what it is I am trying to do.

I want to build a map of a rural area and display roads, houses and other major features whose locations are stored on a database (so that ANY rural area can be displayed once it is entered into the database).  But I don't just want to mark each house with simple X or square, I want it to look good.  I plan to use JSP to build each map based on parameters.

I was hoping I could send the VML commands to draw a house once identify it as an object and then send a command to draw all the other house objects at different locations.  In VML is there something like v:draw objectId="house; top=Y; left=X" where the objectId identifies the VML commands previously sent that actually draw a house?

Remember I only want to send the actual drawing of the house once, and then be able to reference it as many times as I like.

My own research lead me to consider shapetypes but I am not sure if they will do what I want, I suspect that each usage of a shape type actually loads the entire shape again, not what I want.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
M256Commented:
Can you post a link to your VML files so I can play around with them?

Matthew
0
 
M256Commented:
0
 
macgreAuthor Commented:
I don't have any VML files to show yet, but the VMLFrame link you provided seems interesting, I will try it on my own to see if it meets my needs.  I'll get back to you by Monday OK?
0
 
mis_understoodCommented:
Why not go towards SVG. atleast it can be view in other browsers and not just IE. (of course, you need to have the SVG plug in before you can view it, which is freely downloadable)

http://www.learnsvg.com/
http://www.w3schools.com/svg/default.asp

Hope this helps.

0
 
macgreAuthor Commented:
I actually plan to use SVG as well, on the home page you would set certain options or I would figure out a way to autodetect if the SVG plugin was present.  The Java code would then take the raw data and apply either VML or SVG as required to produce output the client browser supported.  Now since IE is so common and I didn't want to hassle people with "you must get this plugin first" I decided I would do both.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now