Home » Actionscripts library » External Communication
|
Add to my sidebar for Netscape 6
//Netscape 6 supports an addPanel method:
//It is not a bookmark but a sidebar entry.
<script language="JavaScript">
<!--
function addToSidebar() {
if (window.sidebar && window.sidebar.addPanel)
{
window.sidebar.addPanel("yoursite.com","http://www.yoursite.com/ns6sidebar.html","");
} else {
alert("Your browser do not support this feature.")
}
}
//-->
</script>
//In Flash, you can use a getURL action to call the JavaScript function.
on (release) {
javascript:addToSidebar();
}
//In your ns6sidebar.html (the sidebar file is a regular html file) you have add target="_content" to your links:
//i.e.
<a href="index.html" target="_content">Index</a>
<br><a href="news.html" target="_content">News</a>
//So that they load in the main browser window.
Posted by: No name | website http:// |
getURL ("myPage.htm?#bottom");
//Or on a button:
on (release) {
getURL ("myPage.htm?#bottom");
}
Posted by: Evgueni Strok | website http://www.actionscript.org |
on (release) {
getURL ("javascript:window.close()");
}
on (release) {
getURL ("javascript:self.close()");
}
Posted by: Evgueni Strok | website http:// |
/* =================
* Class constructor
* =================
* Desc: Creates the localStorage object.
* Retrieves a local shared object (this.so) and initializes it .
* =================
* Created by ashim saha.
* contact : s_ashim@hotmail.com
*/
// open a new flash file
// Action for 1st frame
function localStorage () {
// Get a reference to the local shared object.
this.so = SharedObject.getLocal("sharedObject");
// If there's no myvalue container property yet, make one.
if (typeof this.so.data.myvalue == "undefined") {
this.so.data.myvalue = "null";
}
}
ls = new localStorage();
//Creating connection Object
sendingLC = new LocalConnection();
update_so.text = "Write text...";
btn.onPress = function(){
txt = update_so.text;
// Code in the sending movie
sendingLC.send("lc_name", "methodToExecute",txt)
ls.so.data.myvalue = txt;
update_so.text = "";
updateAfterEvent();
}
// Action for 2nd frame
//Retrieves any previous value if stored or updates if new value is registered.
output1.text = ls.so.data.myvalue;
// Action for 3rd frame
_root.gotoAndPlay(2);
//save file and open another new file
// Action for 1st frame
receivingLC = new LocalConnection();
// Action for 2nd frame
receivingLC.connect("lc_name");
receivingLC.methodToExecute = function(txt) {
output2.text = txt;
}
// Action for 3rd frame
_root.gotoAndPlay(2);
//download resource for better understanding ....hope it works all fine.
Posted by: Ashim Saha | website http://www.irc.co.in |
import mx.events.EventDispatcher; /** * Allows for a simple configuration file to be used while still * typing incoming variables. * * Types Allowed: * String * Number * Boolean * Array * * USAGE: * var config:Configuration = new Configuration("path_to_config.xml"); * config.onLoad = function() { * trace(config['bgcolor']); * }; * * SAMPLE XML CONFIGURATION FILE: * <?xml version="1.0" encoding="utf-8"?> * <configuration> * <property> * <type>String</type> * <name>bgColor</name> * <value>0x000000</value> * </property> * <property> * <type>Number</type> * <name>birthyear</name> * <value>1976</value> * </property> * <property> * <type>Boolean</type> * <name>raining</name> * <value>false</value> * </property> * <property> * <type>Array</type> * <name>days</name> * <arraydata> * <arrayentry> * <type>String</type> * <value>Monday</value> * </arrayentry> * <arrayentry> * <type>String</type> * <value>Tuesday</value> * </arrayentry> * <arrayentry> * <type>String</type> * <value>Wednesday</value> * </arrayentry> * </arraydata> * </property> *</configuration> * * @author <a href="mailto:joshua@bitset.org">Joshua Hansen</a> * @version 0.1 */ class com.shift12.util.Configuration { private var configData:XML; private var status:String; // Used for EventDispatcher public var addEventListener:Function; public var removeEventListener:Function; public var dispatchEvent:Function; /** * Constructor * @param configFile:String */ public function Configuration(configFile:String) { EventDispatcher.initialize(this); loadConfigData(configFile); } /** * Loads configuration settings * @param configFile:String * @return */ private function loadConfigData(configFile:String):Void { var ptr:Object = this; var xml:XML = new XML(); xml.ignoreWhite = true; xml.onLoad = function(success:Boolean) { if(success) { ptr.configData = new XML(); ptr.configData = this; ptr.parseData(); } else { throw new Error("Could not load configuration settings. File: " + configFile); } }; xml.load(configFile); } /** * Parses the configuration data * @see loadConfigData */ private function parseData():Void { var type:String; var data:String; var name:String; var numItems:Number = configData.childNodes[0].childNodes.length; for(var i=0;i<numItems;i++) { var cNode:XMLNode = configData.childNodes[0].childNodes[i]; type = cNode.childNodes[0].childNodes[0].nodeValue; name = cNode.childNodes[1].childNodes[0].nodeValue; if(type.toLowerCase() != "array") { data = cNode.childNodes[2].childNodes[0].nodeValue; addItem(type, data, name); } else { data = cNode.childNodes[2]; addItem(type, data, name); } } // notify user we're done this.dispatchEvent({type:"onLoad"}); cleanUp(); } /** * Adds configuration settings to this object * @param type:String Type of data to be * @param data:String Data * @param name:String Name of variable to be set */ private function addItem(type:String, data:String, name:String):Void { switch(type.toLowerCase()) { case "string": this[name] = makeString(data); break; case "boolean": this[name] = makeBoolean(data); break; case "number": this[name] = makeNumber(data); break; case "array": this[name] = makeArray(data); break; default: this[name] = makeString(data); break; } } /** * Casting functions * @param data:String * note that makeArray takes a string * but it is an xml node. */ private function makeString(data:String):String { return String(data); } private function makeBoolean(data:String):Boolean { return Boolean(data); } private function makeNumber(data:String):Number { return Number(data); } private function makeArray(data:String):Array { var xml:XML = new XML(data); var type:String; var value:String; var node:XMLNode; var buffer:Array = new Array(); for(var i=0;i<xml.childNodes[0].childNodes.length;i++) { node = xml.childNodes[0].childNodes[i]; type = node.childNodes[0].childNodes[0].nodeValue; value = node.childNodes[1].childNodes[0].nodeValue; switch(type.toLowerCase()) { case "string": buffer.push(makeString(value)); break; case "number": buffer.push(makeNumber(value)); break; case "boolean": buffer.push(makeBoolean(value)); break; default: buffer.push(makeString(value)); break; } } return buffer; } private function cleanUp():Void { delete configData; } } Posted by: Joshua Hansen | website http://www.bitset.org |

