Welcome to Dream.In.Code
Getting Help is Easy!

Join 86,383 Programmers. There are 1,388 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Using Javascript to send Xml data to flash

 
Reply to this topicStart new topic

Using Javascript to send Xml data to flash, From text link send "ID#" to flash

bmcc81
post 29 Apr, 2008 - 07:01 AM
Post #1


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70



Hi,

What I'm trying to do is send an "ID number to flash" that will I will be able to use to choose the right "Song Playlist"


Here is an example of what I already have. My Webpage

Is there a way to add this to a html tag like this to send XML ID# to flash?

CODE
<a href= "#" xml = "12345" VALUE="Goto Frame 1" ONCLICK="go(1)" >go to the frame 1 </a>



I'd need some kinda of JavaScript that would pass the info on to flash. I think this would work

CODE

function send(xml) {
  if (movieIsLoaded(thisMovie(movieName))) {      //
    xmlHttp.send(xml);
  }
}




I've never written JavaScript so it's probably all Wrong.


Would that be a way to send xml ="12345" into my SWF?

Thanks,

Also how would I know if it got through into flash? hehe.gif
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


bmcc81
post 29 Apr, 2008 - 08:27 AM
Post #2


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70

Okay so now I think that I have to use:

CODE
function send(xml) {
  if (movieIsLoaded(thisMovie(movieName))) {      //
    thisMovie(movieName).send(xml);
  }
}


I'm just not sure if this .send(xml); will actually send the information in my <a ref> tag

CODE
<a href= "#" xml = "12345" VALUE="Goto Frame 1" ONCLICK="go(1)" >go to the frame 1 </a>


Does anyone know if this is right?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

bmcc81
post 29 Apr, 2008 - 10:29 AM
Post #3


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70

Basically what I learned was from
http://moock.org/webdesign/flash/fscommand/index.html




User is offlineProfile CardPM
Go to the top of the page
+Quote Post

girasquid
post 29 Apr, 2008 - 10:41 AM
Post #4


Barbarbar

Group Icon
Joined: 3 Oct, 2006
Posts: 953

You might want to try using the "edit post" button to add to your post - that way it stays in the "new topics" area and people are more likely to look at it.

Regarding actually moving the XML over to Flash, I'm not sure - off the top of my head, I don't think this is possible other than via FlashVars. Would FlashVars achieve what you're looking for, or have you looked at them yet?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

bmcc81
post 29 Apr, 2008 - 12:09 PM
Post #5


D.I.C Head

**
Joined: 10 Jul, 2007
Posts: 70

Thanks that FlashVars Thing helped a bit I found this page now FlashVars

Which really, Really Helped.

Thanks,

That was exactly what I was looking for.

So now I can send info into flash. To be specific into a textField. Check it out Here


I used the JavaScript Function:
CODE

function PassFlash(){
    thisMovie(movieName).SetVariable("text", "TC2_52869");
}



and in my flash I made a text Field that I gave the a variable name = text

and now it sends the info from my a ref text link in html into javascript the to flash.

now I just have to make an if statement in my flash that will change my relative path to the xml file.

Thanks again,
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

yamini_dhopavkar
post 12 May, 2008 - 01:08 AM
Post #6


New D.I.C Head

*
Joined: 24 Apr, 2008
Posts: 5

In flash file use function ExternalInterface.addCallBack()... This function takes 3 parameters... u can get the details about this function in help of flash using this function u can call a flash function from javaScript and pass the XML file to flash.
In flash u can parse this file to get the details u want. The entire code example is available in HELP of Flash 8...


ExternalInterface.call(): this functions can be used to call a JavaScript function from a flash code i.e from Action Script
ExternalInterface.addCallBack() : Using this function we can call a flash function that a Action script function from a JavaScript function

the above two
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/17/08 03:51AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month