haxxus
Technical User
- Oct 23, 2008
- 2
Hello
I recently bought a little product which enables me to open a flash popup window from a link within a flash object. The pop requires two files flashpopup.js and flashpop.as The line to call the flash popup from the link within my flash navigation swf is the Actionscript line: FlashPopup.add(" 400, 400, 0, 0);
Here is the code in the .AS file
Here is the Code in the .JS file
and here is how the readme tells you to install it
Quote:2. Copy FlashPopup.as to your project folder, place it in the same map as your .fla
3. Copy flashPopup.js to your project folder, place it in the same map as your .html, where your flash file is embedded in.
4. Set the wmode of your flash file embedded in the .html to transparent.
In flash:
File -> Publish Settings -> HTML tab -> Window Mode = Transparent Windowless
5. Copy the next line to your .html file, where your flash file is embedded in. Place it between the head tags:
<script type="text/javascript" src="flashPopup.js"></script>
6. Copy the next lines to your .html file, where your flash file is embedded in. Place them between the body tags:
<div id="divFrame" style="position:absolute; top:0; left:0">
<iframe frameborder="0" id="iframe" name="iframe" src="" style="position:absolute; top:0; left:0" width="0" height="0"></iframe>
</div>
TIP: After you have done this, remove the HTML tick in the Publish Settings menu so your html file doesn’t get overwritten.
7. Now you can open a popup with the next line in flash (for both flash versions):
FlashPopup.add(" 400, 400, 0, 0);
Argument 1: Page for the popup, can be everything (.html, .php, .jpg, .swf)
Argument 2: Width of the popup
Argument 3: Height of the popup
Argument 4: X-Position of the popup, can be a number or “middle” (with quotes!)
Argument 4: Y-Position of the popup, can be a number or “middle” (with quotes!)
FlashPopup.remove(); This will remove the FlashPopup
Now it works , but only from flash using the FlashPopup.add(" 400, 400, 0, 0); on a button . My problem is i have a Flash site and i want to use this popup to bring my other sites in between my flash site top and buttom menu and the buttons i have setup in this flash site to call the backgrounds witch will be the place the popup will show is triggered from an external XML file, This is the XML file;
Is it even possible ? if so how can i add FlashPopup.add(" 400, 400, 0, 0); in that XML file for the different buttons.
I recently bought a little product which enables me to open a flash popup window from a link within a flash object. The pop requires two files flashpopup.js and flashpop.as The line to call the flash popup from the link within my flash navigation swf is the Actionscript line: FlashPopup.add(" 400, 400, 0, 0);
Here is the code in the .AS file
Code:
/**
* ...
* @author Lars van Meurs
* @version 0.1
*/
class FlashPopup {
public function FlashPopup() {
}
public static function add(url:String, width:Number, height:Number, x, y) {
getURL("javascript:flashPopup('" + url + "', '" + x + "', '" + y + "', " + width + ", " + height + ")", "_self");
}
public static function remove():Void {
getURL("javascript:flashPopup('',0,0,0,0)", "_self");
}
}
Code:
function flashPopup(html, x, y, width, height) {
var iframe = document.getElementById('iframe');
var div = document.getElementById('divFrame');
iframe.src = html;
iframe.width = width;
iframe.height = height;
if (x == "middle") {
div.style.left = '50%';
iframe.style.left = width * -0.5;;
} else {
div.style.left = x;
iframe.style.left = 0;
}
if (y == "middle") {
div.style.top = '50%';
iframe.style.top = height * -0.5;
} else {
iframe.style.top = 0;
div.style.top = y;
}
}'')
and here is how the readme tells you to install it
Quote:2. Copy FlashPopup.as to your project folder, place it in the same map as your .fla
3. Copy flashPopup.js to your project folder, place it in the same map as your .html, where your flash file is embedded in.
4. Set the wmode of your flash file embedded in the .html to transparent.
In flash:
File -> Publish Settings -> HTML tab -> Window Mode = Transparent Windowless
5. Copy the next line to your .html file, where your flash file is embedded in. Place it between the head tags:
<script type="text/javascript" src="flashPopup.js"></script>
6. Copy the next lines to your .html file, where your flash file is embedded in. Place them between the body tags:
<div id="divFrame" style="position:absolute; top:0; left:0">
<iframe frameborder="0" id="iframe" name="iframe" src="" style="position:absolute; top:0; left:0" width="0" height="0"></iframe>
</div>
TIP: After you have done this, remove the HTML tick in the Publish Settings menu so your html file doesn’t get overwritten.
7. Now you can open a popup with the next line in flash (for both flash versions):
FlashPopup.add(" 400, 400, 0, 0);
Argument 1: Page for the popup, can be everything (.html, .php, .jpg, .swf)
Argument 2: Width of the popup
Argument 3: Height of the popup
Argument 4: X-Position of the popup, can be a number or “middle” (with quotes!)
Argument 4: Y-Position of the popup, can be a number or “middle” (with quotes!)
FlashPopup.remove(); This will remove the FlashPopup
Now it works , but only from flash using the FlashPopup.add(" 400, 400, 0, 0); on a button . My problem is i have a Flash site and i want to use this popup to bring my other sites in between my flash site top and buttom menu and the buttons i have setup in this flash site to call the backgrounds witch will be the place the popup will show is triggered from an external XML file, This is the XML file;
Code:
<?xml version="1.0" encoding="utf-8"?>
<item>
<background>background/background1.jpg</background>
<title>Background Image One</title>
<thumb>background/sm_imgs/img1.jpg</thumb>
</item>
<item>
<background>background/background2.jpg</background>
<title>Background Image Two</title>
<thumb>background/sm_imgs/img2.jpg</thumb>
</item>
<item>
<background>background/background3.jpg</background>
<title>Background Image Three</title>
<thumb>background/sm_imgs/img3.jpg</thumb>
</item>
<item>
<background>background/background4.jpg</background>
<title>Background Image Four</title>
<thumb>background/sm_imgs/img4.jpg</thumb>
</item>
<item>
<background>background/background5.jpg</background>
<title>Background Image Five</title>
<thumb>background/sm_imgs/img5.jpg</thumb>
</item>
Is it even possible ? if so how can i add FlashPopup.add(" 400, 400, 0, 0); in that XML file for the different buttons.