HOME | DD
Published: 2012-06-19 02:51:44 +0000 UTC; Views: 354; Favourites: 5; Downloads: 3
Redirect to original
Description
import flash.text.TextField;// The following functions are useful for getting information about the swf that is deployed
// you can get who uploaded this file, to perhaps use the various dA APIs
// Long usernames may be truncated, I obviously have not tested this
// you can also get the name the file was named before uploading
// note that long names may be truncated
// and that filenames are set to lower-case
// mixed case letters will need to be encoded and decoded
// this is a great way to pass some kind of ...
// information where you would use a single flashvar
// put sample stuff onto the stage so you can output the values
var textBox:TextField = new TextField();
textBox.width = stage.stageWidth;
textBox.height = stage.stageHeight;
addChild(textBox);
textBox.text = "title before being uploaded: "+getDAtitle() +"\nuploader: "+getDAuploader() +"\nDeviation ID: "+getDAid();
// function to get the filename before uploading
// once submitted to a deviantArt gallery, the Deviation Title should not be changed
// a new SWF cannot be uploaded either as it will take on the Deviation Title instead of the original filename
// This ONLY WORKS for deviations uploaded via sta.sh by selecting the file and uploading it or dragging and dropping
// see my youtube example for passing information (a youtube video ID) in the uploaded filename
function getDAtitle(){
var daTitle = this.loaderInfo.url.split("/");
daTitle = daTitle[daTitle.length-1].split("_by_");
daTitle.pop();
return (daTitle);
}
// function to get the uploader's username
function getDAuploader(){
var uploader = (this.loaderInfo.url).split("_by_");
uploader = uploader[uploader.length-1].split("-");
uploader.pop();
return (uploader);
}
// function to get a deviation's ID, not sure where this is useful
function getDAid(){
var deviationID = (this.loaderInfo.url).split(".swf").join("").split("-");
return deviationID.pop();
}