Pages: [1]
  Print  
Author Topic: XML files and classes.  (Read 222 times)
wbeyda
Gaia Novice
*
Posts: 3


« on: July 11, 2011, 08:49:24 PM »

I've been using Gaia but I keep running into problems. I'm trying to create a photo gallery following this tutorial http://active.tutsplus.com/tutorials/effects/create-a-responsive-xml-image-scroller-in-actionscript-3-0/ and I when I copy the first line of actionscript and change it to redirect to my XML file I get tons of errors.

C:\Users\windoze\Desktop\New Site\src\com\sun\pages\GalleryPage.as, Line 35   1120: Access of undefined property xmlLoader.
C:\Users\windoze\Desktop\New Site\src\com\sun\pages\GalleryPage.as, Line 35   1120: Access of undefined property xmlPath.
C:\Users\windoze\Desktop\New Site\src\com\sun\pages\GalleryPage.as, Line 36   1120: Access of undefined property xmlPath.
C:\Users\windoze\Desktop\New Site\src\com\sun\pages\GalleryPage.as, Line 37   1120: Access of undefined property xmlLoader.
C:\Users\windoze\Desktop\New Site\src\com\sun\pages\GalleryPage.as, Line 37   1120: Access of undefined property LoadXML.




Code:
package com.sun.pages
{
import com.gaiaframework.templates.AbstractPage;
import com.gaiaframework.events.*;
import com.gaiaframework.debug.*;
import com.gaiaframework.api.*;
import flash.display.*;
import flash.events.*;
import com.greensock.TweenMax;
import flash.net.URLLoader
import flash.net.URLRequest

public class GalleryPage extends AbstractPage
{
public function GalleryPage()
{
super();
alpha = 0;

}
override public function transitionIn():void
{
super.transitionIn();
TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete});
}
override public function transitionOut():void
{
super.transitionOut();
TweenMax.to(this, 0.3, {alpha:0, onComplete:transitionOutComplete});
}
private var xmlLoader:URLLoader = new URLLoader();
private var xmlData:XML = new XML();
private var xmlPath:String = "photo.xml";

xmlLoader.load(new URLRequest(xmlPath));
trace("loading xml from: " + xmlPath);
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

function LoadXML(e:Event):void
{
trace("xml loading complete");
xmlData = new XML(e.target.data);
trace(xmlData.image);//we'll see each image xml element listed in the output panel with this xmlList
}
}
}

This is just the begining I haven't even put anything on the stage yet  Huh
Logged
Nemo
Moderator
Gaia Addict
*****
Posts: 594


Freelancer for hire


WWW
« Reply #1 on: July 11, 2011, 11:54:12 PM »

Show this 1 line of code
Logged

!
wbeyda
Gaia Novice
*
Posts: 3


« Reply #2 on: July 12, 2011, 12:24:45 AM »

Show this 1 line of code

Show what? one line of code? Can you be a little more clear?
Logged
Nemo
Moderator
Gaia Addict
*****
Posts: 594


Freelancer for hire


WWW
« Reply #3 on: July 12, 2011, 12:34:03 AM »

Show code that make error
Logged

!
wbeyda
Gaia Novice
*
Posts: 3


« Reply #4 on: July 12, 2011, 12:40:09 AM »

It's all up there. In the first post.
Logged
Nemo
Moderator
Gaia Addict
*****
Posts: 594


Freelancer for hire


WWW
« Reply #5 on: July 12, 2011, 12:53:42 AM »

Code Does not display on my phone Sad. Now i see it. You put Your code beyond function. Put it in transitionin function.
Logged

!
steven
Gaia Author
Administrator
Gaia Evangelist
*****
Posts: 3871


gaiaframework
WWW
« Reply #6 on: July 12, 2011, 02:19:55 AM »

You cannot have code like that floating free in a class.

Code:
xmlLoader.load(new URLRequest(xmlPath));
trace("loading xml from: " + xmlPath);
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

Put that in the constructor or transitionIn.
Logged

Steven Sacks | Gaia Author
Please support Gaia by donating to the project!  Smiley
Pages: [1]
  Print  
 
Jump to:  

TinyPortal v1.0 beta 4 © Bloc