The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 10 of 10

Thread: Flash HTML javascript help !!!

  1. #1

    Flash HTML javascript help !!!

    Hi All,

    I made a flash which is having couple of images inside. I want to show the clicked image on a HTML. For that I want to send the image name to the HTML. Also that html must not have menubar, toolbar and statusbar (only image needs to be there).

    Here I have done something…

    btnClipMc.addEventListener(MouseEvent.CLICK,onBtnC licked);

    var address:String = ("two.html");
    var URL_var:URLVariables = new URLVariables();

    function onBtnClicked(evt:MouseEvent):void
    {
    URL_var.query = inpTxt.text;
    var jscommand:String = "window.open('" + address + "','win','toolbar=no,scrollbars=no,location=no,sta tus=no,menubar=no') ;";
    urlReq:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
    urlReq.data = URL_var;
    navigateToURL(urlReq, "_self");
    }

    This is showing error message when I include “urlReq.data = URL_var” line.

    Can you help me to correct this script ? !!!

  2. #2
    I'm not sure to have properly understood. You have an image on your server, and this image is embedded into the SWF. When you click this image, you would like to send a string (the name of the file) to html. This name should be used to create a new html page containing the image. Then you would like to redirect your browser to this page (or alternately open a new tab with the new html page). Is it right?

  3. #3
    Quote Originally Posted by giobongio View Post
    I'm not sure to have properly understood. You have an image on your server, and this image is embedded into the SWF. When you click this image, you would like to send a string (the name of the file) to html. This name should be used to create a new html page containing the image. Then you would like to redirect your browser to this page (or alternately open a new tab with the new html page). Is it right?
    I am sorry if i didn't explained properly, Almost what you said. I have 5 different images on my server, the same images are loaded into the flash. and also i created a HTML page which i will use to show the images. Now in flash when the user click on a particular image, that image should be loaded into the HTML which we already have on the server.

    So i need to pass the name from flash to html to find the clicked image to show. also i want to hide the tool, status bar ... on the HTML.

    If it is possible to load the HTML on full-screen that will be great
    Last edited by karthic_vkn; June 26th, 2012 at 03:51 AM.

  4. #4
    Ok, I see your point now. In your case, I would add 5 img tags to the html page. Each tag includes one image and has its own ID:
    HTML Code:
    <img border="0" src="/images/image1.jpg" alt="Image1" id="image1"/>
    <img border="0" src="/images/image2.jpg" alt="Image2" id="image2"/>
    ...
    I then would add a javascript function into the header section to show one of the images:
    HTML Code:
    function showImage(imgID) 
    {
      var images = document.getElementsByTagName("img").innerHTML;
      for(var i=0; i<images.length; i++)
      {
        images[i].style.display = "none";
      }
      document.getElementById(imgID).style.display = "";
    }
    To pass a string from flash to html you may use the ExternalInterface.call. With this method you can invoke a javascript function from flash with arguments. For example:
    Code:
    import flash.external.ExternalInterface;
    // image ID depends on which image you have clicked into flash...
    ExternalInterface.call("showImage", "image1");
    The problem here is that images and flash are embedded into the same page. You may i.e. accomplish your goal by embedding swf into a div and hide this div into the showImage function. I'm perfectly conscious that these snippets are not a solution but they may give you a start point.. Hope it helps.

  5. #5
    Alternatively, you may create as many html pages as many images you have, and add one image to each page. You may name these pages like "image1.html", "image2.html"... and open them from flash like this:
    Code:
    var req:URLRequest = new URLRequest("image1.html");
    navigateToURL(req, "_blank");
    It's a trivial, not scalable (and not-so-tricky) solution, but it may work if you don't have too many images.

  6. #6
    Dear Giobongio, Thanks for your kind reply. Here i want to mention that "5 images" a example only. Images will more than 50. So we can't make separate HTML.

    The main HTML name (flash loaded HTML) will be "flashLoad.html" and the second HTML name will be "imageLoad.html". So we need to call "imageLoad.html" from flash. Second HTML load with the image that triggered by flash !!!. Also the second HTML load without menu bar, status bar, scroll bar ... !!!
    Last edited by karthic_vkn; June 26th, 2012 at 06:37 AM.

  7. #7
    Just for my own undestanding, why are you creating such a complicated system to just display an image?
    As3 / JS/jQuery / HTML5 / CSS(3) / PHP (intermediate)

  8. #8
    Quote Originally Posted by MJTheOne View Post
    Just for my own undestanding, why are you creating such a complicated system to just display an image?
    Good question

    A image i have intwo different size like small and big. Flash will show the small size image andwhen you click on the small image on flash, you can see the same image in largesize on a new html !!! ??? That new HTMLmust be restricted like show only image not like a browser.

    How do you do that?, Do you have any east way to do this ???

  9. #9
    This could easily be done using a jQuery Image Gallery plugin
    As3 / JS/jQuery / HTML5 / CSS(3) / PHP (intermediate)

  10. #10
    How can you do that ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012