Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • 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="">
<br>
<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>
<tr><td>State:</td>
<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">
</table>
</div>
</form>

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
  Else
    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),""),",")
%>

<tr>
<td>
<table cellpadding="0" cellspacing="0" width="250">
<tr>
<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>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" class="stock">
<table cellpadding="0" cellspacing="0">
<tr>
<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>
0
mikesandra
Asked:
mikesandra
  • 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.

0
 
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?
0
 
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.

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.

 
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?
0
 
MontoyaProcess Improvement MgrCommented:

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

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=7455+Chancellor+Dr&1c=Orlando&1s=FL&1z=32809-6213&2y=US&2ffi=&2l=&2g=&2pl=&2v=&2n=&2pn=&2a=250+s.+Orange+Avenue&2c=Orlando&2s=FL&2z=32801&panelbtn=2

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:
mybutton_btn.onPress=function(){
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.
0
 
mikesandraAuthor Commented:
Let me play with this.  I'll let you know how it turns out.
0
 
mikesandraAuthor Commented:
Iammontoya,

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.

on(release){
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?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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