Forum » Programiranje » Flash XML Galerija
Flash XML Galerija
advokat ::
Potrebujem nekoga da mi cez vikend proti placilu na narejeno flash stran naredi galerijo, kjer se slike jemljejo preko xml.
ponudbe pošljite na mail:
advokati@yahoo.com
ponudbe pošljite na mail:
advokati@yahoo.com
chrush ::
Pozdravljeni!
Tole napako mi javi, ko hočem prikazati foto galerijo, pa ne najdem rešitve. Mi lahko kdo prosim pomaga?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main/parseXML()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
pa še main datoteka
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class Main extends MovieClip {
public var currentImg:Number;
public var lastImg:Number;
public var xml:XML;
public var loader:Loader;
public var xmlLoader:URLLoader;
public function Main() {
loader = new Loader();
addChild(loader);
xmlLoader = new URLLoader(new URLRequest("/gallery.xml"));
xmlLoader.addEventListener(Event.COMPLETE, parseXML);
left_mc.stop();
right_mc.stop();
}
protected function parseXML(event:Event):void {
left_mc.addEventListener(MouseEvent.MOUSE_UP, nextImg);
left_mc.addEventListener(MouseEvent.MOUSE_OUT, arrowOut);
left_mc.addEventListener(MouseEvent.MOUSE_OVER, arrowOver);
right_mc.addEventListener(MouseEvent.MOUSE_UP, prevImg);
right_mc.addEventListener(MouseEvent.MOUSE_OUT, arrowOut);
right_mc.addEventListener(MouseEvent.MOUSE_OVER, arrowOver);
xml = new XML(event.currentTarget.data);
lastImg = xml.img.length() - 1;
currentImg = 0;
loadImg();
}
protected function loadImg():void {
loader.x = (stage.width - Number(xml.img[currentImg].@width))/2;
loader.y = (stage.height - 50 - Number(xml.img[currentImg].@height))/2;
loader.load(new URLRequest(xml.@dir + xml.img[currentImg].@file));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFin);
}
protected function loadFin(event:Event):void {
textDisp_TF.htmlText = xml.img[currentImg];
}
protected function arrowOut(event:MouseEvent):void {
MovieClip(event.currentTarget).gotoAndStop(1);
}
protected function arrowOver(event:MouseEvent):void {
MovieClip(event.currentTarget).gotoAndStop(2);
}
protected function nextImg(event:MouseEvent):void {
loader.unload();
currentImg = (currentImg < lastImg)? currentImg + 1 : 0;
loadImg();
}
protected function prevImg(event:MouseEvent):void {
loader.unload();
currentImg = (currentImg > 0)? currentImg - 1 : lastImg;
loadImg();
}
}
}
Tole napako mi javi, ko hočem prikazati foto galerijo, pa ne najdem rešitve. Mi lahko kdo prosim pomaga?
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Main/parseXML()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
pa še main datoteka
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class Main extends MovieClip {
public var currentImg:Number;
public var lastImg:Number;
public var xml:XML;
public var loader:Loader;
public var xmlLoader:URLLoader;
public function Main() {
loader = new Loader();
addChild(loader);
xmlLoader = new URLLoader(new URLRequest("/gallery.xml"));
xmlLoader.addEventListener(Event.COMPLETE, parseXML);
left_mc.stop();
right_mc.stop();
}
protected function parseXML(event:Event):void {
left_mc.addEventListener(MouseEvent.MOUSE_UP, nextImg);
left_mc.addEventListener(MouseEvent.MOUSE_OUT, arrowOut);
left_mc.addEventListener(MouseEvent.MOUSE_OVER, arrowOver);
right_mc.addEventListener(MouseEvent.MOUSE_UP, prevImg);
right_mc.addEventListener(MouseEvent.MOUSE_OUT, arrowOut);
right_mc.addEventListener(MouseEvent.MOUSE_OVER, arrowOver);
xml = new XML(event.currentTarget.data);
lastImg = xml.img.length() - 1;
currentImg = 0;
loadImg();
}
protected function loadImg():void {
loader.x = (stage.width - Number(xml.img[currentImg].@width))/2;
loader.y = (stage.height - 50 - Number(xml.img[currentImg].@height))/2;
loader.load(new URLRequest(xml.@dir + xml.img[currentImg].@file));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFin);
}
protected function loadFin(event:Event):void {
textDisp_TF.htmlText = xml.img[currentImg];
}
protected function arrowOut(event:MouseEvent):void {
MovieClip(event.currentTarget).gotoAndStop(1);
}
protected function arrowOver(event:MouseEvent):void {
MovieClip(event.currentTarget).gotoAndStop(2);
}
protected function nextImg(event:MouseEvent):void {
loader.unload();
currentImg = (currentImg < lastImg)? currentImg + 1 : 0;
loadImg();
}
protected function prevImg(event:MouseEvent):void {
loader.unload();
currentImg = (currentImg > 0)? currentImg - 1 : lastImg;
loadImg();
}
}
}
https://www.facebook.com/OverMuraMuviMejkers
chrush ::
nisem še ugotovil za ta primer. Sem pa rešil z galerijo na drug način
https://www.facebook.com/OverMuraMuviMejkers
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [Java] Nova nit znotraj JPanel.paintComponent()Oddelek: Programiranje | 1960 (1747) | alexa-lol |
» | Flash - določanje hitArea v MovieClipOddelek: Izdelava spletišč | 865 (799) | lesnik24 |
» | Prosim za predloge in pripombeOddelek: Izdelava spletišč | 2130 (1273) | msjr |
» | Flash CS4 password access AS 3.0Oddelek: Programiranje | 1592 (1334) | 680x0 |
» | [Flash AS3] Povezava z MySQLOddelek: Programiranje | 1957 (1818) | 680x0 |