00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 import flash.external.*;
00014
00015 var xmlGroupChunk = new XML();
00016 xmlGroupChunk.ignoreWhite = true;
00017 var readyToProcessChunk:Boolean = false;
00018 var xmlChunkBuffer:Array = new Array();
00019
00020
00021 this._lockroot = true;
00022
00023
00024 var runAsEmbedded:Boolean = false;
00025
00026
00027 var methodName:String = "livePreview";
00028 var instance:Object = null;
00029 var method:Function = extLivePreview;
00030
00031 var methodName2:String = "liveMetadata";
00032 var instance2:Object = null;
00033 var method2:Function = extLiveMetadata;
00034
00035 var methodName4:String = "loadGroupXMLChunk";
00036 var instance4:Object = null;
00037 var method4:Function = loadGroupXMLChunk;
00038
00039
00040
00041
00042
00043 if((livePreview == "true") || (livePreview == undefined)){
00044 var wasSuccessful:Boolean = ExternalInterface.addCallback(methodName, instance, method);
00045 ExternalInterface.addCallback(methodName2, instance2, method2);
00046 ExternalInterface.addCallback(methodName4, instance4, method4);
00047 }
00048
00049
00050
00051 this.attachMovie("Gallery","gallery",100,{embedEnabled:runAsEmbedded});
00052
00053
00054
00055 var podWidth:Number = 805;
00056 var podHeight:Number = 596;
00057 if(_parent)
00058 runAsEmbedded = true;
00059 else
00060 runAsEmbedded = false;
00061 function setSize(w, h)
00062 {
00063 podHeight = h;
00064 podWidth = w;
00065
00066 gallery.setHeightWidth(h,w);
00067 }
00068
00069
00070
00071 var _oPreloadListener = new Object();
00072 _oPreloadListener._parent = this;
00073
00074
00075 Stage.scaleMode = "noScale";
00076 Stage.align = "TL";
00077 Stage.addListener(_oPreloadListener);
00078 _oPreloadListener.onResize = resizeStage;
00079 _oPreloadListener.onResize();
00080
00081
00082 function resizeStage(){
00083 mcWaitBar._y = Stage.height/2;
00084 mcWaitBar._x = Stage.width/2;
00085 }
00086
00087
00088
00089
00090
00091
00092
00093 function extLivePreview(styleNode:String):Void{
00094 gallery.livePreview(styleNode);
00095 }
00096
00097 function extLiveMetadata(p_node:String):Void{
00098 var styleXML:XML = new XML();
00099 styleXML.parseXML(p_node);
00100 var styleNode:XMLNode = styleXML.firstChild;
00101
00102 switch (styleNode.nodeName) {
00103 case "groupTitle":
00104
00105
00106 styleNode.nodeName = "groupTitleString";
00107 break;
00108 case "siteTitle":
00109 case "pageTitle":
00110
00111
00112 styleNode.nodeName = "pageTitleString";
00113 break;
00114 case "contactEmail":
00115 trace("contactEmail" + styleNode.attributes.value);
00116 break;
00117 case "contactName":
00118 trace("contactName" + styleNode.attributes.value);
00119 break;
00120 case "contactInfo":
00121 if(styleNode.attributes.link.indexOf("http:") == -1){
00122 styleNode.attributes.link = "mailto:"+styleNode.attributes.link;
00123 }
00124 styleNode.nodeName = "contactInfoString";
00125 break;
00126 case "galleryInfo":
00127 if(styleNode.attributes.link.indexOf("http:") == -1){
00128 styleNode.attributes.link = "mailto:"+styleNode.attributes.link;
00129 }
00130 styleNode.nodeName = "contactInfoString";
00131 break;
00132 }
00133
00134 gallery.livePreview(styleNode);
00135 }
00136
00137
00138
00139
00140
00141
00142
00143 function loadGroupXMLChunk(p_path:String){
00144
00145
00146 _root.xmlGroupChunk.onLoad = function(success:Boolean) {
00147 if (success){
00148 _root.gallery.loadGroupXMLChunk(_root.xmlGroupChunk);
00149 trace("z0");
00150 }
00151 else
00152 trace("fail load");
00153 };
00154
00155
00156 if(_root.readyToProcessChunk){
00157
00158 _root.readyToProcessChunk = false;
00159
00160
00161 if(_root.xmlChunkBuffer.length > 0)
00162 _root.xmlGroupChunk.load(_root.xmlChunkBuffer.shift());
00163 else
00164 _root.xmlGroupChunk.load(p_path);
00165 }
00166 else {
00167
00168 _root.xmlChunkBuffer.push(p_path)
00169 }
00170
00171
00172
00173 }
00174
00175
00176 function UIElementClick(p_name:String,p_x:Number,p_y:Number,p_height:Number,p_width:Number,p_fontName:String,p_fontSize:Number,p_textAlign:String){
00177 ExternalInterface.call( 'UIElementClick', p_name, p_x, p_y, p_width, p_height, p_fontName, p_fontSize, p_textAlign );
00178 }
00179
00180 stop();