dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [F8] Linking correctly

  1. #1
    Junior Member
    Join Date
    May 2006
    Location
    Darlington, UK
    Posts
    6

    [F8] Linking correctly

    Hi all,

    For many of you this will be real easy, however for me it isnt. I would like to make a link on a flash button open the page inside an IFrame which is on my page. Is this possible.

    my IFrame is called simply frame and I have tried what I thought was correct but it didnt work, it just opened in anew window.

    My actionscript is as follows

    PHP Code:
    b1.onRollOver over;
    b1.onRollOut out;
    b1.buttText.buttonText.text "Home";
    b1.onRelease = function(){
        
    getURL("thepage.php""target=frame");

    b1 is the button name

    I am stuck and not even sure if you can do it.

    Hope someone can help

    Many Thanks

  2. #2
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    have you tried getURL("thepage.php", "frame");

    maybe this thread can provide further support:
    http://www.actionscript.org/forums/s...d.php3?t=92680

    p.s. I know nothing about this, I just googled "getURL target frame actionscript"
    mmm signature

  3. #3
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813

    Very good question....

    Yes you can do it, but not with Flash alone. If I understand this correctly, when a button in Flash is clicked, you want a web page to appear in an iFrame. This is similar to driving content to a DIV. You're required to use javascript to bridge the connection between Flash and the html page and IFrame.

    What version of actionscript are you using? This is kind of important and you'll use two different calls to perform the task. Regardless of the version, you'll first need a javascript function...something like this:

    In HTML Page include:
    Code:
    <iframe name='somename' width='100' height='100 src='blank.htm' />
    In javascript document:
    Code:
    function openPage(url){
      document.getElementById('somename').src = url; 
    }
    In Flash document:
    Code:
    //Actionscript 2.0
    b1.onRelease = function()
    {
      getURL("javascript:openPage('thePage.php');");
    }
    
    //Actionscript 3.0
    b1.addEventListener(MouseEvent.MOUSE_CLICK, function(){ExternalInterface.call("openPage", "thePage.php");});
    Hope that makes sense.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  4. #4
    Junior Member
    Join Date
    May 2006
    Location
    Darlington, UK
    Posts
    6

    Linking correctly

    Hi Samac,

    I kind of follow you. As I am using actionscript 2 i assume i use the first bit of code.

    Struggling as to where to put the javascript code and also what do I put where you have put 'somename'

    Thanks for the assistance

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