A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Javascript pop-up with XML... possible??

  1. #1
    Join Date
    May 2003

    Javascript pop-up with XML... possible??


    I have a variety of pictures that are linked to an XML list. Right now when you click on a picture, it launches an HTML page. What I'm wondering is if I could use Javascript, and how, to make the screen that launches a certain size.

    Unfortunately, my attempts do not work. I was wondering if any of you have attempted this sort of thing before and how? I haven't found a lot of info written on this subject.

    My code so far is:

    mask_mc._visible = false;
    portfolioInfo = new XML();
    portfolioInfo.ignoreWhite = true;
    timeline = this;
    portfolioInfo.onLoad = function() {
    portfolioTag = this.firstChild;
    count = portfolioTag.childNodes.length;
    for (i=0; i<count; i++) {
    currentPicture = portfolioTag.childNodes[i];
    currentThumb = menu_mc.createEmptyMovieClip("thumbnail"+i, i);
    currentThumb._x = i*40;
    image = currentThumb.createEmptyMovieClip("thumbnail_image ", 0);
    currentThumb.NAME = currentPicture.attributes.NAME;
    currentThumb.IMAGE = currentPicture.attributes.IMAGE;
    currentThumb.onPress = currentThumb.onDragOver=function () {
    getURL (this.IMAGE,"_blank");

    Last edited by sirenetta1; 07-09-2005 at 04:45 PM.

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    You were almost there

    use this instead of geturl:

    javascript("window.open(\""+this.link+"\",\"\",\"w idth="+width+",height="+height+",resizable=no,scro llbars=no,top=\"+((screen.availHeight/2)-(600/2))+\",left=\"+((screen.availWidth/2)-(800/2))+'');");

    set the dimensions to suit you

    I would post the whole code but I'm a swisher ( i also think for flash it is handled differently IE:

    ""+this.link+"" (Swish)

    Flash may be " . this.link . " (someone else can probobly help you with flash syntax)

  3. #3
    Join Date
    May 2003

    Didn't work...


    Sorry, the code didn't work. I need to keep the geturl because it relates to my XML file.

    Nobody has been able to answer this question, so I'm assuming that it is not possible to use XML and Javascript with this functionality.

    I will post my files to this e-mail. By clicking on a picture you can LAUNCH an HTML page, but that HTML page will not be sized to fit the picture in any way.

    Thanks for your help!
    Attached Files Attached Files

  4. #4
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    It's not only possible, it's pretty standard stuff. The code i dropped earlier uses dynamic width and height settings (""+width+"", ""+height+"") I push from the backside....sorry.

    Here is an exported Flash menu made with Swishmax that loads from xml and fires a javascript window:


    it uses this Swishmax code (I'm sure you can adapt to Flash, also hard coded width and height):

    PHP Code:
    [onLoad () {
    menuXML = new XML();
    menuXML.ignoreWhite true;
    menuXML.onLoad = function(success) {
            if (
    success) {
    mainItem this.firstChild.childNodes;
                for (var 
    i=0i<mainItem.lengthi++) {
    item mainmenu.duplicateSprite("mainmenu" ii);
    item._x 293;
    item._y 22*i;
    item.mainlink.text mainItem[i].attributes.name;
    item.link mainItem[i].attributes.link;
    item.onPress = function() {
    //getURL(this.link, "_blank");


    As Swishmax uses almost all actionscript (except2) that flash uses, it should be no problem to adapt to flash. For your width / height, you would either use a setting to match your images (if uniform size) or push it from the xml individually using the original script.
    Last edited by Chris_Seahorn; 07-15-2005 at 12:03 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center