Home Tutorials Forums Articles Blogs Movies Library Employment Press

<< Prev 5 | Next 5

JavaScript / multiple popup windows in Flash

Flash/JavaScript code for CUSTOMIZABLE, MULTIPLE, POP UP BROWSER WINDOWS
////////////////////////////////////////////////////
//Actionscript:
////////////////////////////////////////////////////


on (release) {
        getURL ("Javascript:popupwindow(1)");
}

//note: if you want more than one button in your flash movie to call a new popup window, simply use the abobe actionscript for each button and add +1 each time: (1) for window 1....(2) for window 2...etc...

////////////////////////////////////////////////////
//JavaScript:
////////////////////////////////////////////////////

<head>
<script language="javascript">
function popupwindow(index)
{
        if(index==1)
        {
                site="lageplandetail.html"
        }
        
        window.open(site,"newwindow","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizeable=1,width=600,height=450")
}
</script>

</head>

////////////////////////////////////////////////////
//again, fo rmultiple windows, copy the script :

if(index==1)
{
        site="lageplandetail.html"
}


//and only cahange the number:
if(index==2) for example
//add this below each previous block of script


Posted by: john lyons | website http://www.lyonsdesign.net
Javascript resize pop up window
<script language="Javascript1.2">
<!--
function changeSize(width,height){
        // self.moveTo(0,0); -- optional
        self.resizeTo(width,height);
        // sample call: changeSize(100,200)
}
//-->
</script>
Define that in the HEAD of the parent HTML file and then call it from a FLash button or keyframe, passing it a width and a height. See the Spawing Browse windows tutorial for an example on passing info to a javascript function.


Posted by: No name | website http://
Local Object
/*-----------------------------------------------------------------*\
	File:			LocalObject.as
	Author:			Guy Watson
	Language:		Flash MX Actionscript
	Purpose:		To create a Class which implements the functionality
					of the SharedObject.getLocal() and SharedObject.flush()
					methods in a more conventional, object-oriented and
					undertandable way.

	Dependancies:	Flash Player Settings(Right-click)
	Developed:		March 2001

	Example: 
					1. Create a new instance of the class:
					
						mylocalobject=new LocalObject("mylocalobject")
					
					2. If the LocalObject "mylocalobject" already exists
					   on the local machine, then the "mylocalobject" instance
					   is automatically populated with all the methods and propertes
					   saved on the local machine.
					   
					3. Add some properties and methods to the instance:
					
						mylocalobject.name="Guy Watson"
						mylocalobject.age=18
						mylocalobject.family=["Joel","Craig","Gemma"]
						mylocalobject.outputFamily=function(){
							var i=this.family.length
							while(--i){
								trace(this.family[i])
							}
						}
						
					4. Save the contents of the "mylocalobject" instance to a file
					   on the local machine:
					   
					   	mylocalobject.save()
					   
					   
	Class:
					LocalObject

	Public Methods:
					save()
					load()
	Private Properties: 
					uin - A property which is passed as an argument to the LocalObject
					      constructor. This is used to reference the file saved on the
						  local machine.

	Copyright Guy Watson, 2002.  All Rights Reserved.
\*-----------------------------------------------------------------*/

_global.LocalObject=function(uin){
	this.uin=uin
	ASSetPropFlags(this,["uin"],3,1)
	this.load()
}
_global.LocalObject.prototype.save=function(){
	var t=SharedObject.getLocal(this.uin)
	for(var i in this){
		t.data[i]=this[i]
	}
	return t.flush()
}
_global.LocalObject.prototype.load=function(){
	var t=SharedObject.getLocal(this.uin)
	for(var i in t.data){
		this[i]=t.data[i]
	}
}
ASSetPropFlags(_global.LocalObject.prototype,null,3)
ASSetPropFlags(_global,null,3)

Posted by: FlashGuru | website http://www.flashguru.co.uk
LocalDebugger
/**
*
*@author Eric Feminella
*@class LocalDebugger
*@package debug
*
*/



class debug.LocalDebugger
{
        static public function trace(_trace:Object):Void {
                var sender:LocalConnection = new LocalConnection();
                sender.send("DebugConnection", "traceOut", _trace);
        }
}

Posted by: Eric Feminella | website http://www.ericfeminella.com
LocalDebuggerReciever
/**
*
*@ Author: Eric Feminella
*@ Class: Debugger
*@ Published: 01.18.06
*
*/





class debug.LocalDebuggerReciever
{
        
        private var receiver:LocalConnection;
        private var clear_btn:Button, txt:TextField;
        
        
        public function LocalDebuggerReciever(clear_btn:Button, txt:TextField)
        {
                this.clear_btn = clear_btn;
                this.txt = txt;
                this.setConnection();
        }
        
        
        private function setConnection():Void
        {
                var ref:LocalDebuggerReciever = this;
                
                this.receiver = new LocalConnection();
                
                this.receiver.allowDomain = this.receiver.allowInsecureDomain = function(domain:String):Boolean {
                        return true;
                }
                
                this.receiver.traceOut = function(param:String):Void {
                        ref.txt.htmlText += param + "<br/>";
                };
                
                this.receiver.connect("DebugConnection");
                
                this.clear_btn.onPress = function():Void {
                        ref.txt.text = "";
                }
        }
        
        
}

Posted by: Eric Feminella | website http://www.ericfeminella.com

<< Prev 5 | Next 5

Copyright 2000-2010 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.