wow im happy to see this thread breathing! When I started it I couldn't find anything usable via Google! (although I needed a pure flash solution)
Printable View
wow im happy to see this thread breathing! When I started it I couldn't find anything usable via Google! (although I needed a pure flash solution)
OK I need some more specification here...
From what I've seen, that code goes into dreamweaver and not flash, correct?
What I need is just the flash-side code, and no need for guild stuff.
The idea is just for making guildies signatures, and not having to update them every time we change gear...that's it.
So I just need the code for flash to get the char's info, and display it. And I also need to know how to get certain details, because different classes will want different info displayed. Tanks will want def, armor, block etc. DPS will want melee/spell dmg, etc.
And yes, I would like it very much if you posted the fla you're using...
this is the code that is being run to fill the database once the roster has been populated.
you can clean up the database queries and you will have the key's used to fill in each member table
all you have to do is echo these out straight to flash instead of sending them to a database and have flash load it via loadvars.
Code:<?php
include("../dbconnect.php");
connect();
//empties current member list for new population
echo "Member table is being cleaned.";
$clean = "TRUNCATE TABLE members";
mysql_query($clean);
$sql = "SELECT * FROM `roster`";
$res = mysql_query($sql);
function contents($parser, $data){}
function startTag($parser, $data, $param)
{
global $i;
global $j;
global $prof;
global $profVal;
global $tree1;
global $tree2;
global $tree3;
if($param["KEY"] != NULL)
{
$prof[$i] = $param["KEY"];
$profVal[$i] = $param["VALUE"];
$i++;
}
if($param["TREEONE"] != NULL)
{
$tree1 = $param["TREEONE"];
$tree2 = $param["TREETWO"];
$tree3 = $param["TREETHREE"];
}
}
function endTag($parser, $data){}
while($dataS = mysql_fetch_row($res))
{
$i=0;
$j=0;
$prof = Array();
$profVal = Array();
$tree1 = 0;
$tree2 = 0;
$tree3 = 0;
$myvar = curl_init();
$name = $dataS[1];
$level = $dataS[2];
$race = $dataS[3];
$class = $dataS[4];
$rank = $dataS[5];
$myURL = "http://www.wowarmory.com/character-sheet.xml?r=Lightninghoof&n=" . $name;
curl_setopt($myvar, CURLOPT_USERAGENT, '[Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2")]');
curl_setopt($myvar, CURLOPT_URL, $myURL);
curl_setopt($myvar, CURLOPT_RETURNTRANSFER, TRUE);
$xmlstr = curl_exec ($myvar);
curl_close ($myvar);
$data = $xmlstr;
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startTag", "endTag");
xml_set_character_data_handler($xml_parser, "contents");
if(!(xml_parse($xml_parser, $data))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
$sql = "INSERT INTO `members` VALUES(NULL, '$name', '$level', '$race' , '$class', '$rank', '$tree1', '$tree2', '$tree3', '$prof[0]', '$prof[1]', '$profVal[0]', '$profVal[1]', 'none')";
if(!mysql_query($sql)) die("Error inserting values");
}
echo "<br>";
echo "Members details successfully populated.";
?>
Yay, now that's more like it...
Thank you thank you thank you soooo much!!!!
If I have any problems getting it to work, I'll be sure to post here.
Thanks again!
no prob :)
Glad you found a solution Baterax....
however I dont think this is really 'on-topic' since it was:
1.) an all FLASH solution origianlly
2.) then the situation of the same FLASH/AS code not working in CS3.
the PHP solution is fine.. but really wasnt part of the equation.. :) Not that it was welcomed of course. (to be clear)
but.. to be CLEAR.. there should be NO NEED FOR PHP AT ALL.
again.. PHP IS NOT NEEDED.
the F8/AS2 solution posted doesnt need any PHP/server side scripting help.
however the SAME CODE/.FLA opened and saved in CS3 still as an AS2 document, does NOT work from what I am told.
I know CS3/AS3 has anew way of handling XML..but I thought it would be compatible still??
Actually, an all-flash solution would be better, because I don't know the first thing about PHP, and thus I'm having trouble using that solution.
Found this C++ code, if it helps...
---8<---
// You will need this include to make use of the internet MFC classes
#include <afxinet.h>
// This is a browser version string that will trick the Arena into believing
// we're a browser that supports XML/XSL.
static const char s_szAgent[] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2";
CString strXml; // We'll be storing the XML data in here.
try
{
// Make a session, appearing to be a "modern browser"
CInternetSession objSession(s_szAgent);
// Open the URL, transfer as ASCII, don't load from cache and don't store in cache.
CHttpFile* pFile = (CHttpFile*)objSession.OpenURL(strURL, 1,INTERNET_FLAG_TRANSFER_ASCII | INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE);
// If open succeeded, read the file.
if (pFile)
{
CString strLine;
while (pFile->ReadString(strLine))
{
strXML+=strLine;
strXML+="\n";
}
pFile->Close();
delete pFile;
}
}
catch (CInternetException* pEx)
{
pEx->ReportError();
pEx->Delete();
}
---8<---
Im sorry..
I guess Im just NOT following anymore..
1.) an ALL flash solution has been provided.. posted and working exmaples made.. you didnt want them I guess? F8 only I believe.
2.) somehow PHP got thrown into the mix here.. no clue why
3.) and now C++ is being used??
I need the flash only thing to work in CS3, so that didn't solve it...
well if you get tired of waiting you can always grab a demo of flash8 just to output your file, you'll have 30 days to figure out your app hehe :D
I think CS3 has a different native way of dealing with XML... so things may be different.. I dont have CS3 to play with (well not installed at least).. or maybe AS3 just has a new way of dealing with it..
im sorry if my post went off topic, was just trying to help.
that being said, I used php because I did not want to ping the armory everytime someone refreshed the site or accessed the page, hence storing the data and doing biweekly updates or so.
I stated your input was helpful & welcomed.. I just wanted to be clear on the GOAL/TOPIC as well as clarify that PHP or C++ nor any 3rd party tool is required... and how to get the same code to work with CS3.. even if exported for Flash Player 8 & AS2 (I believe those settings were tried)
OK I still can't make it work...anyone else???
OMG!>. what is wrong now? You have SEVERAL examples even posted for you...
If your looking for help on PHP or C++ or whatever else your trying to use.. this probably IS NOT THE PLACE to get help for that.
(Maybe the backend & scripting forum here)??
No, I need the only solution that isn't posted. CS3.
Because I've been trying desperately to get the flash 8 version to work in CS3, no luck even using flash 8 publish setting.
Bump!
Bump!
You'd probably get more help is you posted in the AS3 forum..since you want an AS3 solution....
Actually, I want an AS2 solution that works in CS3, which is different from an AS3 solution...
I was able to use this AS3 tutorial:
http://www.kirupa.com/developer/flas...ml_as3_pg1.htm
Using that, I got as fat as having armory info show in the Output box.
But then, AS3 doesn't let you set a textfield variable in the Properties panel, so I'm lost again. this type of thing is exactly why I need it to be in AS2.
Quote:
If you were to publish the SWF and reload the widget in your browser now, you would encounter the good ol' security sandbox violation error, one of my personal favorites. Actually if you didn't setup a debug player and logging you wouldn't really see anything much at all. It just wouldn't work. If you are tailing the flashlog.txt file, you see this:
requesting http://www.wowarmory.com/character-s...nflight&n=Ming
ErrorHandler: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation:http://localhost:10001/widget/wowarm.../WowArmory.swf cannot load data from http://www.wowarmory.com/character-sheet.xml?r=Black%20Dragonflight&n=Ming."]
This is because the wowarmory.com server doesn't have crossdomain.xml file in the root. If you're using Firefox as a browser and you have Firebug installed (or Fiddler in IE or even Wireshark – possible overkill there) you'll see that the browser requests a crossdomain.xml file and doesn't find one.
http://blog.overlay.tv/2008/09/10/cr...tv-sdk-part-2/
This seems to be why it does not want to work, would explain a lot except for things working in Flash8 that is ...
nope that's not the problem. The sandbox issue doesn't effect an swf when previewing from flash (or when saved as a projector). If you wanted to embed your armory feed swf in a browser and host it online then the problem would arise. This (and really all the problems people are having when using as2) can be easily solved by simply calling the needed armory data from a php file on your server which would just print the results. Then you just call that php file from flash rather than trying to talk with the armory directly.
Use this as a tutorial
WoW im awesome and woot is a word
Well i'm confused to weather we can actually pull and XML file still. I think that is the goal here seeing how it's in the XML area.
As far as AS3 i've been fiddling with my own version and i run into a problem of flash not wanting to send the user-agent header. When i publish it, it just says that it cannot access the server.
wowData_txt is a text box.Code:var xmlloader:URLLoader = new URLLoader();
var xml:XML;
function doneloading(e:Event):void
{
wowData_txt.text="hahah";
xml = new XML(e.target.data);
wowData_txt.text=xml.toString();
}
function init():void
{
// load the "slides.xml" file
trace("here");
xmlloader.addEventListener(Event.COMPLETE, doneloading);
// load the xml
var wowhead:URLRequestHeader=new URLRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2");
var rootURL:String = "http://www.wowarmory.com/character-sheet.xml?";
var charRealm:String = "Duskwood";
var charName:String = "doom";
var charSheetXML_URL:String = rootURL +"r="+ charRealm +"&n="+ charName;
trace(charSheetXML_URL);
var re:URLRequest = new URLRequest(charSheetXML_URL);
//re.method=URLRequestMethod.POST;
re.requestHeaders=new Array(wowhead);
wowData_txt.text="aaaaaaaa";
xmlloader.load(re);
wowData_txt.text="bbbbbbbbb";
}
init();
This is AS3 created in CS4.
i'm not sure what this will print out of the request ever actually went through however it gets stuck at xmlloader.load(re) and claims it cannot send user-agent headers.
I also changed the character because the one in the old examples is not active anymore.
Hello Guys,
I have been trying to do the same thing, and I noticed what the problem was after several attempts, yo may al ready know this but I think it may help some one.
The error:
"2096 The HTTP request header <header_name> cannot be set via ActionScript"
In this case "the User-Agent" is banned by Adobe.
They state that this is for security reasons.
This link shows you the statement from Adobe.
http://kb2.adobe.com/cps/403/kb403030.html
Info from Adobe
http://livedocs.adobe.com/flash/9.0/...imeErrors.html
If any one has an update on this further my information please let me know.