Beiträge: 5 Wohnort: Coruscant Registriert: Jul 2011
| 27.07.2011, 09:27
Hallo
Folgendes Problem:
Ich soll einen Flash-Banner[AS2] (programmiert von Person-A [nicht ich]), der Text/Bilder aus einer von PHP erzeugten XML Datei (von Person-B [auch nicht ich]) bezieht, dazu zu bringen das ganze gegebenenfalls auf Kyrillisch auszuspucken. Sowohl Person-A als auch Person-B sagen das ihr Skript einwandfrei funktioniert...
Da ich seit 6 Jahren kein aufwendigeres AS mehr programmiert habe und mit PHP nur auf mySQL basis gearbeitet habe, komm ich irgendwie nicht weit und hoffe das ihr mir helfen könnt.
Die Ausgabe in Flash bring immer "war nix".
AS-Teil
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 | System.useCodepage = false;
import QueryString.as;
import mx.transitions.*;
import mx.transitions.easing.*;
import flash.filters.*;
if (xmlFileName != undefined) {
myTxt.text = xmlFileName;
}
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function(loaded) {
if (loaded) {
var xmlNode = this.firstChild;
image = [];
description = [];
effektlist = [];
anz = xmlNode.childNodes.length;
for (var i = 0; i<anz; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
effektlist[i] = xmlNode.childNodes[i].attributes.effect;
}
if (anz<2) {
einBild();
} else {
nextPic();
}
} else {
trace("war nix");
}
};
xmlFileID = _root.xmlFileID;
navText = _root.navText;
var xml_urlpath = 'defaultFlashXML.php?' + xmlFileID + '&navText=' + navText;
xmlData.load(xml_urlpath);
anzeige.swapDepths(6);
var tl = this;
var i = -1;
var slidePause = 6;
tl.createEmptyMovieClip("watcher",0);
tl.watcher.createEmptyMovieClip("loader1",1);
tl.watcher.createEmptyMovieClip("loader2",3);
tl.createEmptyMovieClip("maske_mc",4);
// Slidefunktion
function nextPic() {
clearInterval(tl.slideshow);
i += back ? -1 : 1;
if (i>=anz) {
i = 0;
} else if (i<0) {
i = anz-1;
}
if (mc != tl.watcher.loader1) {
mc = tl.watcher.loader1;
} else {
mc = tl.watcher.loader2;
}
mc._alpha = 0;
mc.swapDepths(3);
mc.loadMovie(image[i]);
tl.watcher.onEnterFrame = function() {
var l = mc.getBytesLoaded();
var t = mc.getBytesTotal();
if (l>=t && l>4) {
delete this.onEnterFrame;
mc._alpha = 100;
trace(anz);
if (anz<2) {
tween1.onMotionFinished = function() {
tween1.stop();
tween2.stop();
tween3.stop();
tween4.stop();
tween5.stop();
tween6.stop();
};
}
cleaner();
tl.anzeige.beschr_txt.text = description[i];
tl.anzeige.beschr_txt2.text = description[i];
var effektname= effektlist[i];
var tween1:Tween = new Tween(tl.anzeige.beschr_txt, "_xscale", Regular.easeOut, 50, 100, slidePause, true);
var tween2:Tween = new Tween(tl.anzeige.beschr_txt, "_yscale", Regular.easeOut, 50, 100, slidePause, true);
var tween3:Tween = new Tween(tl.anzeige.beschr_txt, "_alpha", None.easeNone, 0, 50, slidePause, true);
var tween4:Tween = new Tween(tl.anzeige.beschr_txt2, "_xscale", Regular.easeOut, 70, 150, slidePause, true);
var tween5:Tween = new Tween(tl.anzeige.beschr_txt2, "_yscale", Regular.easeOut, 70, 150, slidePause, true);
var tween6:Tween = new Tween(tl.anzeige.beschr_txt2, "_alpha", None.easeNone, 0, 80, slidePause, true);
if (tl.anzeige.beschr_txt.text == "undefined") {
tl.anzeige.beschr_txt.text = "";
tl.anzeige.beschr_txt2.text = "";
}
if (effektname == "lamellen") {
TransitionManager.start(mc,{type:Blinds, direction:0, duration:1, easing:Regular.easeOut, numStrips:6, dimension:0});
}
if (effektname == "burns") {
tl.maske_mc.attachMovie("mc2","maske",100);
tl.maske_mc.maske._height = 295;
tl.maske_mc.maske._width = 1000;
tl.watcher.setMask("maske_mc");
new Tween(mc, "_xscale", None.easeNone, 100, 110, slidePause-1, true);
new Tween(mc, "_yscale", None.easeNone, 100, 110, slidePause-1, true);
new Tween(mc, "_x", None.easeNone, 0, -20, slidePause-1, true);
new Tween(mc, "_y", None.easeNone, 0, -8.5, slidePause-1, true);
TransitionManager.start(mc,{type:Fade, direction:0, duration:slidePause, easing:None.easeNone});
}
if (effektname == "iris") {
TransitionManager.start(mc,{type:Iris, direction:0, duration:4, easing:Regular.easeOut, startPoint:5, shape:"CIRCLE"});
}
if (effektname == "schieben") {
TransitionManager.start(mc,{type:Fly, direction:0, duration:3, easing:Regular.easeOut, startPoint:4});
}
if (effektname == "pixel") {
TransitionManager.start(mc,{type:PixelDissolve, direction:0, duration:2, easing:None.easeNone, xSections:50, ySections:11});
}
if (effektname == "stauchen") {
TransitionManager.start(mc,{type:Squeeze, direction:0, duration:2, easing:Regular.easeOut, dimension:1});
}
if (effektname == "verwischen") {
TransitionManager.start(mc,{type:Wipe, direction:0, duration:2, easing:Regular.easeOut, startPoint:2});
}
if (effektname == "photo") {
TransitionManager.start(mc,{type:Photo, direction:0, duration:2, easing:Strong.easeOut});
}
if (effektname == "linien") {
tl.attachMovie("linien","maske",100);
mc.setMask("maske");
}
if (effektname == "lamellen2") {
tl.attachMovie("lamellen2","maske",100);
mc.setMask("maske");
}
if (effektname == "schieben2") {
tl.attachMovie("schieben2","maske",100);
mc.setMask("maske");
}
if (effektname == "punkte") {
tl.attachMovie("punkte","maske",100);
mc.setMask("maske");
}
tl.slideshow = setInterval(nextPic, slidePause*1000);
}
};
}
// einBild
function einBild() {
i += back ? -1 : 1;
if (i>=anz) {
i = 0;
} else if (i<0) {
i = anz-1;
}
if (mc != tl.watcher.loader1) {
mc = tl.watcher.loader1;
} else {
mc = tl.watcher.loader2;
}
mc.loadMovie(image[i]);
tl.watcher.onEnterFrame = function() {
var l = mc.getBytesLoaded();
var t = mc.getBytesTotal();
if (l>=t && l>4) {
delete this.onEnterFrame;
trace(anz);
cleaner();
tl.anzeige.beschr_txt.text = description[i];
tl.anzeige.beschr_txt2.text = description[i];
var tween1:Tween = new Tween(tl.anzeige.beschr_txt, "_xscale", Regular.easeOut, 50, 100, slidePause, true);
var tween2:Tween = new Tween(tl.anzeige.beschr_txt, "_yscale", Regular.easeOut, 50, 100, slidePause, true);
var tween3:Tween = new Tween(tl.anzeige.beschr_txt, "_alpha", None.easeNone, 0, 50, slidePause, true);
var tween4:Tween = new Tween(tl.anzeige.beschr_txt2, "_xscale", Regular.easeOut, 70, 150, slidePause, true);
var tween5:Tween = new Tween(tl.anzeige.beschr_txt2, "_yscale", Regular.easeOut, 70, 150, slidePause, true);
var tween6:Tween = new Tween(tl.anzeige.beschr_txt2, "_alpha", None.easeNone, 0, 80, slidePause, true);
if (tl.anzeige.beschr_txt.text == "undefined") {
tl.anzeige.beschr_txt.text = "";
tl.anzeige.beschr_txt2.text = "";
}
if (effektname == "lamellen") {
TransitionManager.start(mc,{type:Blinds, direction:0, duration:1, easing:Regular.easeOut, numStrips:6, dimension:0});
}
if (effektname == "burns") {
tl.maske_mc.attachMovie("mc2","maske",100);
tl.maske_mc.maske._height = 295;
tl.maske_mc.maske._width = 1000;
tl.watcher.setMask("maske_mc");
new Tween(mc, "_xscale", None.easeNone, 100, 110, slidePause-1, true);
new Tween(mc, "_yscale", None.easeNone, 100, 110, slidePause-1, true);
new Tween(mc, "_x", None.easeNone, 0, -20, slidePause-1, true);
new Tween(mc, "_y", None.easeNone, 0, -8.5, slidePause-1, true);
TransitionManager.start(mc,{type:Fade, direction:0, duration:slidePause, easing:None.easeNone});
}
if (effektname == "iris") {
TransitionManager.start(mc,{type:Iris, direction:0, duration:4, easing:Regular.easeOut, startPoint:5, shape:"CIRCLE"});
}
if (effektname == "schieben") {
TransitionManager.start(mc,{type:Fly, direction:0, duration:3, easing:Regular.easeOut, startPoint:4});
}
if (effektname == "pixel") {
TransitionManager.start(mc,{type:PixelDissolve, direction:0, duration:2, easing:None.easeNone, xSections:50, ySections:11});
}
if (effektname == "stauchen") {
TransitionManager.start(mc,{type:Squeeze, direction:0, duration:2, easing:Regular.easeOut, dimension:1});
}
if (effektname == "verwischen") {
TransitionManager.start(mc,{type:Wipe, direction:0, duration:2, easing:Regular.easeOut, startPoint:2});
}
if (effektname == "photo") {
TransitionManager.start(mc,{type:Photo, direction:0, duration:2, easing:Strong.easeOut});
}
if (effektname == "linien") {
tl.attachMovie("linien","maske",100);
mc.setMask("maske");
}
if (effektname == "lamellen2") {
tl.attachMovie("lamellen2","maske",100);
mc.setMask("maske");
}
if (effektname == "schieben2") {
tl.attachMovie("schieben2","maske",100);
mc.setMask("maske");
}
if (effektname == "punkte") {
tl.attachMovie("punkte","maske",100);
mc.setMask("maske");
}
}
};
}
// cleaner
function cleaner() {
mc.filters = 0;
tl.maske.removeMovieClip();
tl.watcher.maske_mc.removeMovieClip();
}
|
PHP-Teil
PHP: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
|
<?php
ob_start();
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
header ("Content-type: text/xml");
include('../lib/data/dbini.php');
include('./xmlFunctions.php');
$xmlFunctions = new xmlFunctions();
$buffer = NULL;
if(isset($_GET['xmlFileID']) && is_numeric($_GET['xmlFileID'])){
$buffer .= '<?xml version="1.0" encoding="UTF-8"?>';
$sql = "SELECT flashmanagement_relations.flama_rel_text, flashmanagement_relations.flama_rel_pic, flasheffects.fe_descr
FROM flashmanagement
INNER JOIN flashmanagement_relations ON flashmanagement.flama_id = flashmanagement_relations.flama_fk
INNER JOIN flasheffects ON flashmanagement_relations.flama_rel_type = flasheffects.fe_seq
WHERE flashmanagement.flama_id='" . $_GET['xmlFileID'] . "' ORDER BY flashmanagement_relations.flama_rel_sort";
$query = mysql_query($sql);
$buffer .= '<images>';
while($fetch = mysql_fetch_assoc($query))
{
$caption = $fetch['flama_rel_text'];
if(empty($caption)){
$caption = $_GET['navText'];
}
$buffer .= '<pic effect="' . $fetch['fe_descr'] . '">';
$buffer .= '<image><![CDATA[' . $xmlFunctions->getPicByID($fetch['flama_rel_pic']) . ']]></image>';
$buffer .= '<caption><![CDATA[' . $caption . ']]></caption>';
$buffer .= '</pic>';
}
$buffer .= '</images>';
echo $buffer;
}
ob_end_flush();
?>
|
Im moment gibt es zwei versionen davon
Ohne System.useCodepage = false;
Mit System.useCodepage = false; |