Beiträge: 2 Registriert: Jun 2005
| 15.09.2011, 20:57
hallo,
ich habe für ein kleines kostenloses projekt ein template erworben und das template soweit wie ich mit meinen wenigen flash kenntnissen konnte bearbeitet. mein problem ist die beschriftung der buttons die über eine xml datei geladen werden. eigentlich klappt auch alles und die "labels" werden korrekt angezeigt. probleme treten nur auf wenn in dem label ein schrägstrich benutze, denn dann hat der button keine funktion mehr (bsp button mit dem label "DU ICH" funktioniert und label "DU/ICH" funktioniert nicht. Nun habe ich diese Problematik dem Entwickler des Templates gepostet und bekam die Antwort, dass in der SWFaddress Datei etwas umgeändert werden muss damit es funktioniert, er aber nur dafür mal eben 400 Euro will, die ich mir beim besten willen nicht leisten kann. Jetzt meine Frage, ob sich jemand den script man anschauen kann und mir eventuell einen tip geben kann wie ich das symbol für den schrägstrich für meine labels benutzen kann?
die swfaddress.as datei
ActionScript:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | /**
* SWFAddress 2.2: Deep linking for Flash and Ajax <http://www.asual.com/swfaddress/>
*
* SWFAddress is (c) 2006-2008 Rostislav Hristov and contributors
* This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*
*/
import flash.external.ExternalInterface;
import mx.events.EventDispatcher;
import com.asual.swfaddress.SWFAddressEvent;
class com.asual.swfaddress.SWFAddress {
private static var _init:Boolean = false;
private static var _initChange:Boolean = false;
private static var _strict:Boolean = true;
private static var _value:String = '';
private static var _interval:Number;
private static var _availability:Boolean = ExternalInterface.available;
private static var _dispatcher:EventDispatcher = new EventDispatcher();
private static var _initializer:Boolean = _initialize();
public static var onInit:Function;
public static var onChange:Function;
private function SWFAddress() {}
private static function _initialize():Boolean {
if (_availability) {
ExternalInterface.addCallback('getSWFAddressValue', SWFAddress,
function():String {return this._value});
ExternalInterface.addCallback('setSWFAddressValue', SWFAddress,
SWFAddress._setValue);
}
if (typeof _level0.$swfaddress != 'undefined')
SWFAddress._value = _level0.$swfaddress;
_interval = setInterval(SWFAddress._check, 10);
return true;
}
private static function _check():Void {
if ((typeof SWFAddress.onInit == 'function' || typeof _dispatcher['__q_init'] != 'undefined') && !_init) {
SWFAddress._setValueInit(_getValue());
SWFAddress._init = true;
}
if (typeof SWFAddress.onChange == 'function' || typeof _dispatcher['__q_change'] != 'undefined') {
clearInterval(_interval);
SWFAddress._init = true;
SWFAddress._setValueInit(_getValue());
}
}
private static function _strictCheck(value:String, force:Boolean):String {
if (SWFAddress.getStrict()) {
if (force) {
if (value.substr(0, 1) != '/') value = '/' + value;
} else {
if (value == '') value = '/';
}
}
return value;
}
private static function _getValue():String {
var value:String, ids:String = 'null';
if (_availability) {
value = String(ExternalInterface.call('SWFAddress.getValue'));
ids = String(ExternalInterface.call('SWFAddress.getIds'));
}
if (ids == 'undefined' || ids == 'null' || !_availability) {
value = SWFAddress._value;
} else {
if (value == 'undefined' || value == 'null') value = '';
}
return _strictCheck(value || '', false);
}
private static function _setValueInit(value:String):Void {
SWFAddress._value = value;
if (!_init) {
_dispatchEvent('init');
} else {
_dispatchEvent('change');
}
_initChange = true;
}
private static function _setValue(value:String):Void {
if (value == 'undefined' || value == 'null') value = '';
if (SWFAddress._value == value && SWFAddress._init) return;
if (!SWFAddress._initChange) return;
SWFAddress._value = value;
if (!_init) {
SWFAddress._init = true;
if (typeof SWFAddress.onInit == 'function' || typeof _dispatcher['__q_init'] != 'undefined') {
_dispatchEvent('init');
}
}
_dispatchEvent('change');
}
private static function _dispatchEvent(type:String):Void {
if (typeof _dispatcher['__q_' + type] != 'undefined') {
_dispatcher.dispatchEvent(new SWFAddressEvent(type));
}
type = type.substr(0, 1).toUpperCase() + type.substring(1);
if (typeof SWFAddress['on' + type] == 'function') {
SWFAddress['on' + type]();
}
}
public static function toString():String {
return '[class SWFAddress]';
}
public static function back():Void {
if (_availability)
ExternalInterface.call('SWFAddress.back');
}
public static function forward():Void {
if (_availability)
ExternalInterface.call('SWFAddress.forward');
}
public static function up():Void {
var path:String = SWFAddress.getPath();
SWFAddress.setValue(path.substr(0, path.lastIndexOf('/', path.length - 2) + (path.substr(path.length - 1) == '/' ? 1 : 0)));
}
public static function go(delta:Number):Void {
if (_availability)
ExternalInterface.call('SWFAddress.go', delta);
}
public static function href(url:String, target:String):Void {
target = (typeof target != 'undefined') ? target : '_self';
if (_availability && System.capabilities.playerType == 'ActiveX') {
ExternalInterface.call('SWFAddress.href', url, target);
return;
}
getURL(url, target);
}
public static function popup(url:String, name:String, options:String, handler:String):Void {
name = (typeof name != 'undefined') ? name : 'popup';
options = (typeof options != 'undefined') ? options : '""';
handler = (typeof handler != 'undefined') ? handler : '';
if (_availability && System.capabilities.playerType == 'ActiveX') {
ExternalInterface.call('SWFAddress.popup', url, name, options, handler);
return;
}
getURL('javascript:popup=window.open("' + url + '","' + name + '",' + options + ');' + handler + ';void(0);');
}
public static function addEventListener(type:String, listener:Function):Void {
_dispatcher.addEventListener(type, listener);
}
public static function removeEventListener(type:String, listener:Function):Void {
_dispatcher.removeEventListener(type, listener);
}
public static function dispatchEvent(event:Object):Void {
_dispatcher.dispatchEvent(event);
}
public static function hasEventListener(type:String):Boolean {
return (typeof _dispatcher['__q_' + type] != 'undefined');
}
public static function getBaseURL():String {
var url:String = 'null';
if (_availability)
url = String(ExternalInterface.call('SWFAddress.getBaseURL'));
return (url == 'undefined' || url == 'null' || !_availability) ? '' : url;
}
public static function getStrict():Boolean {
var strict:String = 'null';
if (_availability)
strict = String(ExternalInterface.call('SWFAddress.getStrict'));
return (strict == 'null' || strict == 'undefined') ? _strict : (strict == 'true');
}
public static function setStrict(strict:Boolean):Void {
if (_availability)
ExternalInterface.call('SWFAddress.setStrict', strict);
_strict = strict;
}
public static function getHistory():Boolean {
return Boolean((_availability) ?
ExternalInterface.call('SWFAddress.getHistory') : false);
}
public static function setHistory(history:Boolean):Void {
if (_availability)
ExternalInterface.call('SWFAddress.setHistory', history);
}
public static function getTracker():String {
return (_availability) ?
String(ExternalInterface.call('SWFAddress.getTracker')) : '';
}
public static function setTracker(tracker:String):Void {
if (_availability)
ExternalInterface.call('SWFAddress.setTracker', tracker);
}
public static function getTitle():String {
var title:String = (_availability) ?
String(ExternalInterface.call('SWFAddress.getTitle')) : '';
if (title == 'undefined' || title == 'null') title = '';
return title;
}
public static function setTitle(title:String):Void {
if (_availability) ExternalInterface.call('SWFAddress.setTitle', title);
}
public static function getStatus():String {
var status:String = (_availability) ?
String(ExternalInterface.call('SWFAddress.getStatus')) : '';
if (status == 'undefined' || status == 'null') status = '';
return status;
}
public static function setStatus(status:String):Void {
if (_availability) ExternalInterface.call('SWFAddress.setStatus', status);
}
public static function resetStatus():Void {
if (_availability) ExternalInterface.call('SWFAddress.resetStatus');
}
public static function getValue():String {
return _strictCheck(_value || '', false);
}
public static function setValue(value:String):Void {
if (value == 'undefined' || value == 'null') value = '';
value = _strictCheck(value, true);
if (SWFAddress._value == value) return;
SWFAddress._value = value;
if (_availability) ExternalInterface.call('SWFAddress.setValue', value);
_dispatchEvent('change');
}
public static function getPath():String {
var value:String = SWFAddress.getValue();
if (value.indexOf('?') != -1) {
return value.split('?')[0];
} else {
return value;
}
}
public static function getPathNames():Array {
var path:String = SWFAddress.getPath();
var names:Array = path.split('/');
if (path.substr(0, 1) == '/' || path.length == 0)
names.splice(0, 1);
if (path.substr(path.length - 1, 1) == '/')
names.splice(names.length - 1, 1);
return names;
}
public static function getQueryString():String {
var value:String = SWFAddress.getValue();
var index:Number = value.indexOf('?');
if (index != -1 && index < value.length) {
return value.substr(index + 1);
}
return '';
}
public static function getParameter(param:String):String {
var value:String = SWFAddress.getValue();
var index:Number = value.indexOf('?');
if (index != -1) {
value = value.substr(index + 1);
var params:Array = value.split('&');
var p:Array;
var i:Number = params.length;
while(i--) {
p = params[i].split('=');
if (p[0] == param) {
return p[1];
}
}
}
return '';
}
public static function getParameterNames():Array {
var value:String = SWFAddress.getValue();
var index:Number = value.indexOf('?');
var names:Array = new Array();
if (index != -1) {
value = value.substr(index + 1);
if (value != '' && value.indexOf('=') != -1) {
var params:Array = value.split('&');
var i:Number = 0;
while(i < params.length) {
names.push(params[i].split('=')[0]);
i++;
}
}
}
return names;
}
}
|
|