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

Converting HTML to Work as Actionscript in Flash

I have HTML from mapquest that allows users to get directions to a specific loaction.  How do I convert the below HTML  to work in a Flash file as actionscript?

<form action="http://www.mapquest.com/directions/main.adp" method="get">
<div align="center">
<input type="hidden" name="go" value="1">
<input type="hidden" name="2a" value="">
<input type="hidden" name="2c" value="">
<input type="hidden" name="2s" value="">
<input type="hidden" name="2z" value="">
<input type="hidden" name="2y" value="">
<table border="0" cellpadding="0" cellspacing="0" style="font: 11px Arial,Helvetica;">
<tr><td colspan="2" style="font-weight: bold;"><div align="center"><a href="http://www.mapquest.com/"><img border="0" src="http://cdn.mapquest.com/mqstyleguide/ws_wt_sm" alt="MapQuest"></a></div></td></tr>
<tr><td colspan="2" style="font-weight: bold;">FROM:</td></tr>
<tr><td colspan="2">Address or Intersection: </td></tr>
<tr><td colspan="2"><input type="text" name="1a" size="22" maxlength="30" value=""></td></tr>
<tr> <td colspan="2">City: </td></tr>
<tr> <td colspan="2"><input type="text" name="1c" size="22" maxlength="30" value=""></td></tr>
<td> ZIP Code:</td></tr>
<tr><td><input type="text" name="1s" size="4" maxlength="2" value=""></td><td>
<input type="text" name="1z" size="8" maxlength="10" value=""></td></tr>
<tr><td colspan="2">Country:</td></tr>
<tr><td colspan="2"><select name="1y"><option value="CA">Canada</option><option value="US" selected>United States</option></select></td></tr>
<tr> <td colspan="2" style="text-align: center; padding-top: 10px;"><input type="submit" name="dir" value="Get Directions" border="0"></td></tr>
<input type="hidden" name="CID" value="lfddwid">

I also have other code to convert into actionscript.  This code allows me list a stock price of a company.  How can I use this code in Flash??

function go()
  dim xml, text
  Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
  xml.Open "GET", "http://finance.yahoo.com/d/quotes.csv?s=SIRI&f=sl1d1t1c1ohgv&e=.csv", False
  xml.Send ""
  text = xml.ResponseText
  If Len(text) > 0 Then
    go = text
    Response.Write "404 - File not found..."
  End If
  Set xml = Nothing
end function

dim quote, columns, i
columns = Array("Symbol","Last Trade","Date","Time","Change")
quote = split(replace(go(),chr(34),""),",")

<table cellpadding="0" cellspacing="0" width="250">
<td class="stockheading" align="center" valign="bottom" width="40">Symbol</td><td class="stockheading" align="center" valign="top" width="40">Last<br>Trade</td><td class="stockheading" align="center" valign="bottom" width="45">Change</td><td class="stockheading" align="center" valign="bottom" width="70">Date</td><td class="stockheading" align="center" valign="bottom" width="55">Time</td>
<td valign="top" class="stock">
<table cellpadding="0" cellspacing="0">
<td class="stock" align="center" width="40"><%=quote(0)%></td><td class="stock" align="center" width="40"><%=quote(1)%></td>

<% dim plusminus %>
<% plusminus = trim(quote(4)) %>

<% if Left(plusminus, 1) = "-" then %>
<td class="stockred" align="center" width="45"><%=quote(4)%></td>
<% else %>
<td class="stockgreen" align="center" width="45"><%=quote(4)%></td>
<% end if %>

<td class="stock" align="center" width="70"><%=quote(2)%></td>

<% dim pmam %>
<% pmam = Right(quote(3), 2) %>
<% pmoram = Ucase(pmam) %>
<% pmsorams = Replace(quote(3), pmam, " " & pmoram) %>

<td class="stock" align="center" width="55"><%=pmsorams%></td>
  • 4
  • 3
1 Solution
MontoyaProcess Improvement MgrCommented:
You will not be able to use most of that code inside of flash.

All you can do is try to do work arounds with components and variables. Based on the value of the variable, you can send the user to a different url. Html in flash is limited pretty much to the basic tags <a>, <b>, <p>, <ul>, <u>, <li>, etc... Check out help for a complete list.

So, after all that, you would only have the choice of duplicating the functionality in flash, but it won't be by use of translating html. Sorry to be the bearer of bad news.

mikesandraAuthor Commented:
Well, since this is a 500 point question can someone help me to figure out how I can incorporate this into actionscript and make it work?
MontoyaProcess Improvement MgrCommented:
mikesandra, the points are not important, because it cannot be done. However, if there's something particular effect you're trying to achieve, then please describe that, and I, or one of us, will help you with it.

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

mikesandraAuthor Commented:
What I am trying to achieve are 2 things.  I want to be able to have a user type in their starting address and they click submit and it brings them into a mapquest page with the directions to a specific location.

The other thing I want to do within Flash as show a stock price 20 minutes delayed.  Is this something someone can help me with?
MontoyaProcess Improvement MgrCommented:

Consider the following: It looks difficult, but it is not.


These are directions from a fictitious location in Florida to another.
All you have to do is collect the address city state and zip from the user and substitute the entries above in a getURL statement. so would put on a button:
getURL("http://www.mapquest.com/directions/main.adp?go=1&do=nw&rmm=1&un=m&cl=EN&qq=m4ZeC4eEaUjB0vOlaUxfVSqQlVW3nnEdAEpCN2qTxi78WcDFRId1HDkiFqIdFezMENXPmWiHOSbJdDtAKAq%252brZezQI%252fj2l3xwIUsi1AJvtjbeM9Q9IrhWIPUuoOk9%252f6eRyE36%252friGRzdYXM7TWyERfMa2tYE6hI5v0wcGSQ1sonspwILrojKJEVZVTMStSazUrbJ%252bO4hgTVRO5%252bsfo2tgA%253d%253d&ct=NA&rsres=1&1y=US&1ffi=&1l=3bo8vLyH6bM%253d&1g=Y3B%252b%252fWx2DDg%253d&1pl=&1v=ADDRESS&1n=&1pn=&1a=" +  myAddress + "&1c=" + myCity    .... and so on.

If you'll notice, mapquest wants plus signs instead of spaces in your street, for example. Also, you would have to complete the rest of the text by using the destination address. This is accomplished in very much the same way, except it is easier because you can pre-code the destination, if that is your goal.

Unfortunately, I don't have anything for you on your second question.
mikesandraAuthor Commented:
Let me play with this.  I'll let you know how it turns out.
mikesandraAuthor Commented:

I created a form and a submit button in Flash so they can connect with Mapquest.  I want what the user types into field 1a to get passed to the getURL function.  Something like this.

getURL("http://www.mapquest.com/directions/main.adp?go=1&2a=100+West+Century+Road&2c=Paramus&2s=NJ&2z=07652&2y=USA&1a="+1a+"&1c=Oakland&1s=NJ&1z=07436&dir=Get+Directions&CID=lfddwid", "_blank");

But its not working.  I get the following error;

Scene=Scene 1, Layer=Basic Info, Frame=1: Line 2: ')' or ',' expected
     getURL("http://www.mapquest.com/directions/main.adp?go=1&2a=100+West+Century+Road&2c=Paramus&2s=NJ&2z=07652&2y=USA&1a="+1a+"&1c=Oakland&1s=NJ&1z=07436&dir=Get+Directions&CID=lfddwid", "_blank");

Scene=Scene 1, Layer=Basic Info, Frame=1: Line 3: Unexpected '}' encountered

I don't know what I'm doing wrong.  Can you help me?
Dushan De SilvaTechnology ArchitectCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

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