Jump to content
Search Community

Slideshow attempt.. (noob at LoaderMax!)

mspanish test
Moderator Tag

Recommended Posts

Hi I've already downloaded plenty of the slideshow type demos, I appreciate all the great code - but I'm still having some trouble. Mine is not a pure image slideshow - it's an audio visual e-learning slideshow where the user has to click to advance to the next slide. I've got the thing working great without using XML, but that is super code intensive and the IOS compiler chokes on all this code. So I need to skinny this thing way down, and surely LoaderMax is the way to do it :)

 

(live sample is here - click on the Phonics Slideshow link)

 

http://www.instaspanish.com/dev/demo/#/childrens/up_downvideo

 

So each page or slide has:

 

1- a Spanish phrase

2- an English phrase

3- the Spanish mp3 (named the same as the phrase but with dashes for spaces)

4- the English mp3 (same as above)

5- the image file (names the same as the mp3, but using .swf as the ext).

 

I've got lots of other stuff in there, but since I'm trying to recreate it from scratch, I need to start with the basics. I've never built an XML load using anything other than the cut and past approach, so please excuse my ignorance about how that really works!

 

For my XML, I fashioned something like this:

 

<?xml version="1.0" encoding="iso-8859-1"?>














 

 

So far for my loaderMax slideshow, I have this - not including any imports - I'm not really sure how the page Object works, or how to use it once I populate it with values from the XML - sorry I found that in one of the tutorial examples, and thought it looked close to what I want to do - although I've not figured out how yet... :|

 

var _pages:Array;
var page:Page;

LoaderMax.activate([xmlLoader]);
	var loader:XMLLoader = new XMLLoader("xml/cucaracha_slideshow.xml", {name:"slides", onComplete:onReady});
	loader.load();		
}

function onReady(e:LoaderEvent) : void {

var xml:XML = LoaderMax.getLoader("slides")slide.content as XML;
var slideList:XMLList = xml.slide

var string_txt = new TextField();  
addChild(string_txt);  
string_txt.x=0;  
string_txt.y=350;  
string_txt.width=640; 
string_txt.embedFonts = true;    
string_txt.wordWrap = true;    
string_txt.autoSize="center";    
string_txt.defaultTextFormat = format2;
string_txt.filters = [filter2];   
string_txt.selectable = false ;

var translation_txt = new TextField();  
addChild(translation_txt);  
translation_txt.x=0;  
translation_txt.y=350;  
translation_txt.width=640; 
translation_txt.embedFonts = true;    
translation_txt.wordWrap = true;    
translation_txt.autoSize="center";    
translation_txt.defaultTextFormat = format2;
translation_txt.filters = [filter2];   
translation_txt.selectable = false ;

for each (var slide:XML in slideList)
		{		
       _pages.push( new Page(			
	string_txt.text = xml.@spanish,
	translation_txt.text = xml.@english,
	scramble = xml.@scramble,
	englishAudio = xml.@englishAudio,
	imageSize = xml.@imageSize))
}
}

function createPage():void {

addChild(_page[0]) // I know this line doesn't work but I'm trying to figure out how to add the first page with all its XML values to the stage, then pass those string values down to the loadImage() and playSpanish() functions

loadImage();
playSpanish();		
}

function loadImage():void {
var imagesLoader:LoaderMax = LoaderMax.getLoader("imagesLoader");
//imagesLoader.addEventListener(LoaderEvent.COMPLETE, imagesLoaderCompleteHandler);
imagesLoader.load();	
addChild(LoaderMax.getContent(string_txt + 'SWF') );
}	

function playSpanish():void { 
var soundLoader:LoaderMax = LoaderMax.getLoader("soundLoader");
//soundLoader.addEventListener(LoaderEvent.COMPLETE, soundLoaderCompleteHandler);
soundLoader.load();	
LoaderMax.getLoader(string_txt + 'MP3').playSound()
}

function playEnglish():void { 
var soundLoader:LoaderMax = LoaderMax.getLoader("soundLoader");
//soundLoader.addEventListener(LoaderEvent.COMPLETE, soundLoaderCompleteHandler);
soundLoader.load();	
LoaderMax.getLoader(translation_txt + 'MP3').playSound()
}

 

My existing show uses TimelineMax, like this, with all of the %%A values hard coded into a very bloated .as file generated by DOS!

 

var timeline:TimelineMax = new TimelineMax({paused:false, overwrite:false});

timeline.append(TweenMax.delayedCall(0, initSlide%%A));
timeline.addLabel("page%%A", timeline.duration)
timeline.append(TweenMax.from(page%%A, !slideTime%%A!, {autoAlpha:0, onStart:playSoundNow%%A, onComplete:pauseMe} ) );

 

I don't know if this is enough info to get a little help on the XML issue - I do know how to set up a loop and put the string and image values in a page based on an Array, but loading these from XML is a bit confusing right now. Any help would be really appreciated!

 

warm wishes

Stacey

Link to comment
Share on other sites

Hmm... I found one of Jack's posts to a guy trying to build an image slideshow, and perhaps this will work better as a base to start from... I can see pretty clearly how I could add my page mc here and switch that out instead of the loader in the timeline.

 

var timeline:TimelineMax = new TimelineMax({repeat:2, paused:true});

function XMLLoaded(event:Event):void{   
 xml = new XML(event.target.data);
 var addedListener:Boolean = false;
 for each(var slide in xml.slides){
  var url:String = slide.@url; 
  var id:Number = slide.@id;  //maybe need Int here, always forget the diff!
  var spanish:String = slide.@spanish;
  var english:String = slide.@english;
  var scramble:String = slide.@scramble;
  var spanishmp3:String = slide.@spanishMp3;
  var englishmp3:String = slide.@englishMp3;
  var englishAudio:String = slide.@englishAudio;

  var request:URLRequest = new URLRequest(url);
  var loader:Loader = new Loader();
  loader.x = 250;
  loader.y = 125;
 // loader.alpha = 0;
  loader.load(request);
  addChild(loader);
  timeline.append(TweenMax.to(loader, 0.5, {alpha:1}));
  timeline.append(TweenMax.to(loader, 0.5, {alpha:0}), 2);
  if (!addedListener) {
     loader.addEventListener(Event.COMPLETE, onFirstSlideLoad);
     addedListener = true;
  }
 }
}

function onFirstSlideLoad(event:Event):void {
  timeline.play();
}

//*****====================================================*****
var xml:XML;
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest("xml/cucaracha_slideshow.xml");
loader.addEventListener("complete", XMLLoaded);
loader.load(request);

Link to comment
Share on other sites

Getting closer!

 

I can load the first page for my show. Have not integrated the timeline part yet - but this is a good start. I'll chronicle this here in case it helps anybody else struggling with all of this!

 

I took the mp3s out of the loader - as it's redundant anyway, since the .mp3 files are just variations of the text strings. So here is my updated code:

import com.greensock.events.LoaderEvent;
import com.greensock.loading.LoaderMax;
import com.greensock.loading.SWFLoader;
import com.greensock.loading.XMLLoader;
import com.greensock.loading.MP3Loader;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.loading.*;
import flash.display.*;
import flash.geom.*;
import com.greensock.loading.display.ContentDisplay;
LoaderMax.activate([sWFLoader, MP3Loader, XMLLoader]);

var the_activity:String = "cucaracha";

var _imagesLoader:LoaderMax;

var _pages:Array;
var page:Object;
var _items:Array;

_imagesLoader = LoaderMax.getLoader("imagesLoader") as LoaderMax;

var _xmlLoader = new XMLLoader("xml/cucaracha_slideshow.xml", {name:"slides", estimatedBytes:276700, onComplete:completeHandler, onError:_errorHandler});

init();


function init():void {
trace('init starting...');
_xmlLoader.load();
_imagesLoader.load(); 
}

function _errorHandler(event:LoaderEvent):void {
trace('xml failed to load!');
	}

function completeHandler(event:LoaderEvent):void {
   trace("XML loaded!");

//var item:LoaderMaxItem, thumbnail:DisplayObject, spanishsound:LoaderItem, englishsound:LoaderItem;
//create XMLList from site nodes
//could also do LoaderMax.getContent("sites").site
var slides:XMLList = (_xmlLoader.content as XML).slide; 
var slideCount = slides.length()

trace('here is the slides xml list :' + slides);
trace('here is the slide count ' + slideCount);

var string_txt = new TextField();  
addChild(string_txt);  
string_txt.x=0;  
string_txt.y=350;  
string_txt.width=640;  
string_txt.wordWrap = true;    
string_txt.autoSize="center";     
string_txt.selectable = false ;

var translation_txt = new TextField();  
addChild(translation_txt);  
translation_txt.x=0;  
translation_txt.y=150;  
translation_txt.width=640; 
translation_txt.wordWrap = true;    
translation_txt.autoSize="center";    
translation_txt.selectable = false ;

for each (var xml:XML in slides) {       
     var string = xml.@spanish;
     var translation = xml.@english;
     var scramble = xml.@scramble;
     var englishAudio = xml.@englishAudio;
     var imageSize = xml.@imageSize;

var thumbnail = string + "SWF";
var spanishsound = string + ".mp3";

spanishsound = spanishsound.replace(/ /g, "-");  
spanishsound = spanishsound.replace(/á/g, "a"); 
spanishsound = spanishsound.replace(/é/g, "e"); 
spanishsound = spanishsound.replace(/í/g, "i"); 
spanishsound = spanishsound.replace(/ó/g, "o"); 
spanishsound = spanishsound.replace(/ú/g, "u"); 
spanishsound = spanishsound.replace(/ú/g, "u"); 
spanishsound = spanishsound.replace(/ñ/g, "n"); 

var  englishsound = translation + ".mp3";

englishsound = englishsound.replace(/ /g, "-");  

trace('here is thumbnail :' + thumbnail)
   trace('here is englishsound :' + englishsound)


string_txt.text =  string;
translation_txt.text =  translation;

trace('here is string! ' + string);

addChild( LoaderMax.getContent(thumbnail));

function playSpanishSound():void {
var sound:MP3Loader = new MP3Loader("assets/" + the_activity + "/sound/" + spanishsound, {name:"audio", autoPlay:true});

sound.load();

}

function playEnglishSound():void {
var sound:MP3Loader = new MP3Loader("assets/" + the_activity + "/sound/" + englishsound, {name:"audio", autoPlay:true});

sound.load();

}

}
}

Link to comment
Share on other sites

Hello Stacey,

 

Very nice project you are working on there. Thank you for sharing that link. I enjoyed exploring the various modules.

 

Your TweenLite/TimelineLite implementations are very impressive. Seems you are not only well versed in things related to AS3 and Tweenlite but a quick learner as well. Great job on getting LoaderMax up and running!

 

As it being late on a Sunday night, its a bit much to digest the entirety of what you have posted but it seems like you are making great progress and have a very dynamic system in place.

 

It looks like you have most of your Page data stored and its just a matter of swapping it around.

 

I don't know how much I will be able to add / assist as far as contributing code or troubleshooting problems on something of this scale... but if you have any troublesome issues you need to work around I'll do my best to add something of value.

 

carl

Link to comment
Share on other sites

Hello Carl- thanks buddy - I've posted on your site a few times, and follow your comments on Twitter when I have time to login there, which isn't too much :)

 

I'm actually on one of your tuts right now, lol :)

 

Here is my revised code - this thing is darn near working!

 

It's the timelineMax that's giving me grief now, mainly trying to navigate to and from the pages. After that I can add back in the other stuff like sound, etc.

 

Here is my new code - I'll post the FLA and stuff too in case it's helpful. Thanks again for looking Carl, you are really the Greensock guru after Jack :)

 

import flash.media.Sound;  
import flash.media.SoundChannel;  
import flash.media.SoundMixer;  
import flash.media.SoundTransform;  
import com.greensock.events.LoaderEvent;
import com.greensock.loading.LoaderMax;
import com.greensock.loading.SWFLoader;
import com.greensock.loading.XMLLoader;
import com.greensock.loading.MP3Loader;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.loading.*;
import com.greensock.easing.Elastic; 
import com.greensock.TweenMax; 
import com.greensock.TweenLite; 
import com.greensock.TimelineMax; 
import com.greensock.events.TweenEvent; 
import com.greensock.plugins.*;
import flash.display.*;
import flash.geom.*;
import flash.filters.*;    
import flash.text.*;  
import com.greensock.loading.display.ContentDisplay;
LoaderMax.activate([sWFLoader, MP3Loader, XMLLoader]);

var slideCount:Number = 100;
var slide:Number = 1;					// set slide number  
var translationVisible:Boolean = false; 
var slideNumber_txt:TextField = new TextField;  
var slide_txt:String = String(slide); 

var nextSlideBtn:Sprite;  
var prevSlideBtn:Sprite;  
var audioBtn:Sprite; 
var hearBtn:Sprite; 
var translationBtn:Sprite; 
var replayBtn:Sprite;  
var page:MovieClip;

var audio_toggle_txt:TextField;
var audio_translation_txt:TextField;  

var filter2:GlowFilter=new GlowFilter(0x000000,1.0,2.0,2.0,10);   
filter2.quality=BitmapFilterQuality.MEDIUM;  


var format6:TextFormat = new TextFormat();    
var format2:TextFormat = new TextFormat();    
var translationFormat:TextFormat = new TextFormat();   

translationFormat.font="Verdana";    
translationFormat.size=70;    
translationFormat.bold = true;  
translationFormat.color = 0xffffff;  
translationFormat.align = TextFormatAlign.CENTER;  
translationFormat.letterSpacing=3;   

// blue default regular 
format2.font="Verdana";    
format2.size=80;    
format2.color = 0x3399ff;  
format2.align = TextFormatAlign.CENTER;  
format2.letterSpacing=1;  

 // blue default regular 
format6.font="Articulate";    
format6.size=11;
format6.bold = false;  
format6.color = 0x000000;  
format6.align = TextFormatAlign.CENTER;  
format6.letterSpacing=2;  

var the_activity:String = "cucaracha";

var _imagesLoader:LoaderMax;


var slideNumberArray:Array = [];
var stringArray:Array = [];
var translationArray:Array = [];
var scrambleArray:Array = [];
var englishAudioArray:Array = [];
var imageSizeArray:Array = [];
var thumbnailBigArray:Array = [];
var thumbnailSmallArray:Array = [];
var spanishSoundArray:Array = [];
var englishSoundArray:Array = [];
var pageArray:Array = [];

var count:Number = 0;
var string:String;
var translation:String;
var scramble:String;
var englishAudio:String;
var imageSize:String;
var thumbnailBig:String;
var thumbnailSmall:String;
var spanishsound:String;
var englishsound:String;

var timeline:TimelineMax = new TimelineMax({paused:false, overwrite:false});  


var _xmlLoader = new XMLLoader("xml/cucaracha_slideshow.xml", {name:"slides", onComplete:completeHandler, onError:_errorHandler});


init();

function init():void {
trace('init starting...');
_xmlLoader.load();

_imagesLoader = LoaderMax.getLoader("imagesLoader") as LoaderMax;
_imagesLoader.load(); 

}

/*function translationReset(event:MouseEvent):void  
{  
translationBtn.alpha = 1; 
audio_translation_txt.text = 'show' + '\n' +  'ENGLISH'; 
clickTranslationOnce=0;  
translationVisible=false; 
hearBtn.alpha = 1; 
} */ 

function addButtons():void {

audio_toggle_txt = new TextField;  
addChild(audio_toggle_txt);  
audio_toggle_txt.x=565;  
audio_toggle_txt.y=47;  
audio_toggle_txt.embedFonts = true;    
audio_toggle_txt.wordWrap = true;    
audio_toggle_txt.autoSize="left";  
audio_toggle_txt.defaultTextFormat = format6;  
audio_toggle_txt.antiAliasType = AntiAliasType.ADVANCED;
audio_toggle_txt.text = 'sound' + '\n' + 'control' ;

audio_translation_txt = new TextField;  
addChild(audio_translation_txt);  
audio_translation_txt.x=563;  
audio_translation_txt.y=133;  
audio_translation_txt.embedFonts = true;    
audio_translation_txt.wordWrap = true;    
audio_translation_txt.autoSize="left";    
audio_translation_txt.defaultTextFormat = format6;
audio_translation_txt.antiAliasType = AntiAliasType.ADVANCED;
audio_translation_txt.text = 'see' + '\n' + 'ENGLISH' ;   

addChild(slideNumber_txt);  
slideNumber_txt.width=150;  
slideNumber_txt.x=5;  
slideNumber_txt.y=505-25;  
slideNumber_txt.embedFonts = true;    
slideNumber_txt.wordWrap = true;    
slideNumber_txt.autoSize="left";    
slideNumber_txt.defaultTextFormat = format6; 
slideNumber_txt.antiAliasType = AntiAliasType.ADVANCED;
slideNumber_txt.text = 'page ' + slide_txt + ' of ' + slideCount ;  

audioBtn = new AudioBtn();   
audioBtn.width = 45;  
audioBtn.height = 45;  
audioBtn.x = 590;  
audioBtn.y = 0;  
addChild(audioBtn)   

translationBtn = new TranslationBtn();   
translationBtn.width = 63;  
translationBtn.height = 45;  
translationBtn.x = 590;  
translationBtn.y = 85;  
addChild(translationBtn)   

hearBtn = new HearBtn();   
hearBtn.width = 63;  
hearBtn.height = 45;  
hearBtn.x = 515;  
hearBtn.y = 0;  
addChild(hearBtn) 

// buttons for navigation  
nextSlideBtn = new GoBtn();   
nextSlideBtn.width = 50  
nextSlideBtn.height = 50  
nextSlideBtn.x = 595;  
nextSlideBtn.y = 448;  
addChild(nextSlideBtn)  

replayBtn = new ReplayBtn();  
replayBtn.width = 75;  
replayBtn.height = 35;  
replayBtn.x = 575;  
replayBtn.y = 453;  
addChild(replayBtn)   
replayBtn.visible = false    

prevSlideBtn = new BackBtn();  
prevSlideBtn.width = 50;  
prevSlideBtn.height = 50;  
prevSlideBtn.x = 535;  
prevSlideBtn.y = 448;  
addChild(prevSlideBtn) 

var myTween1:TweenMax;  
var myTween2:TweenMax;  
}

function _errorHandler(event:LoaderEvent):void {
trace('xml failed to load!');
	}

function completeHandler(event:LoaderEvent):void {
   trace("XML loaded!");

//var slideConfig:XML = LoaderMax.getLoader("slides").content as XML;
var slides:XMLList = (_xmlLoader.content as XML).slide; 
slideCount = slides.length()


trace('here is the slides xml list :' + slides);
trace('here is the slide count ' + slideCount);


var background = new MovieClip(); 
addChild(background)  
background.graphics.beginFill(0xFFFFFF); 
background.graphics.drawRect(-20, -20, 680, 540);  
background.graphics.endFill();  
background.alpha = .4; 

background.addChild( LoaderMax.getContent('bgImage'));
addButtons();

hearBtn.addEventListener(MouseEvent.CLICK, playSpanishSound); 
nextSlideBtn.addEventListener(MouseEvent.CLICK, goForward); 

for each (var xml:XML in slides) { 
     count ++;
     string = xml.@spanish;
     translation = xml.@english;
     scramble = xml.@scramble;
     englishAudio = xml.@englishAudio;
     imageSize = xml.@imageSize;

  thumbnailBig = string + "SWFBIG";
  thumbnailSmall = string + "SWFSMALL";
  spanishsound = string + ".mp3";
  englishsound = translation + ".mp3";

spanishsound = spanishsound.replace(/ /g, "-");  
spanishsound = spanishsound.replace(/á/g, "a"); 
spanishsound = spanishsound.replace(/é/g, "e"); 
spanishsound = spanishsound.replace(/í/g, "i"); 
spanishsound = spanishsound.replace(/ó/g, "o"); 
spanishsound = spanishsound.replace(/ú/g, "u"); 
spanishsound = spanishsound.replace(/ú/g, "u"); 
spanishsound = spanishsound.replace(/ñ/g, "n"); 

englishsound = englishsound.replace(/ /g, "-");  

trace('here is thumbnail Big :' + thumbnailBig)
trace('here is thumbnail Small:' + thumbnailSmall)
   trace('here is englishsound :' + englishsound)

slideNumberArray.push(count);
stringArray.push(string);
translationArray.push(translation);
scrambleArray.push(scramble);
englishAudioArray.push(englishAudio);
imageSizeArray.push(imageSize);
thumbnailBigArray.push(thumbnailBig);
thumbnailSmallArray.push(thumbnailSmall);
spanishSoundArray.push(spanishsound);
englishSoundArray.push(englishsound);

}

createSlides();

}

function createSlides():void {

for(var i:int=0;i

page = new MovieClip;
addChild(page)  
page.graphics.drawRect(0, 0, 640, 480);  
page.graphics.endFill();  
page.alpha = 0;



var string_txt = new TextField();  
page.addChild(string_txt);  
string_txt.x=0;  
string_txt.y=350;  
string_txt.width=640;  
string_txt.wordWrap = true;    
string_txt.autoSize="center"; 
string_txt.embedFonts = true;    
string_txt.autoSize="center";    
string_txt.defaultTextFormat = translationFormat;    
string_txt.filters = [filter2];  
string_txt.selectable = false ;

var translation_txt = new TextField();  

page.addChild(translation_txt);  
translation_txt.x=string_txt.y +15;  
translation_txt.y=-841;  
translation_txt.width=640; 
string_txt.wordWrap = true;    
string_txt.autoSize="center"; 
string_txt.embedFonts = true;    
string_txt.autoSize="center";    
string_txt.defaultTextFormat = format2;    
string_txt.filters = [filter2];  

string_txt.text =  stringArray[0];
trace('the spanish string is ' + stringArray[0]);
translation_txt.text =  translationArray[0];

if (imageSizeArray[i] =='big') {
page.addChild( LoaderMax.getContent(thumbnailBigArray[i]));
trace('adding a Big thumb');
}
else if (imageSizeArray[i] == 'small') {
page.addChild( LoaderMax.getContent(thumbnailSmallArray[i]));	
trace('adding a Small thumb');
}

if (scrambleArray[i] =='no') {

trace('scramble is a no');
}
else if (scrambleArray[i] == 'yes') {

trace('scramble is a yes');
}

spanishsound = spanishSoundArray[i];
englishsound = englishSoundArray[i];

pageArray.push(page);

trace('slide number is ' + slideNumberArray[i]); 
trace('here is the pageArray ' + pageArray[i]);	
//end for loop
}

createTimeline();
//end createPage function
}

function createTimeline():void {
for(var i:int=0;itrace ('im trying to create a timeline');
trace('here is the pageArray ' + pageArray[i]);	
//trace('here is the page num ' + i);	

timeline.addLabel("page" + i, timeline.duration) 
timeline.append(TweenMax.from(pageArray[i], 1, {delay:2, autoAlpha:.5, onComplete:pauseMe} ) )
}
}

function pauseMe():void {  
timeline.pause();  
} 

function playSpanishSound(event:MouseEvent):void {
var sound:MP3Loader = new MP3Loader("assets/" + the_activity + "/sound/" + spanishsound, {name:"audio", autoPlay:true});
SoundMixer.stopAll();
sound.load();

}

function playEnglishSound(event:MouseEvent):void {
var sound:MP3Loader = new MP3Loader("assets/" + the_activity + "/sound/" + englishsound, {name:"audio", autoPlay:true});
SoundMixer.stopAll();
sound.load();	

}

function goForward(event:MouseEvent):void {

trace('trying to go forward');
//timeline.gotoAndStop("page1");
timeline.killTweensOf("page1")
timeline.tweenTo("page2")
//TweenLite.to(timeline, 0.5, {time:3});

}

 

Beware my timeline is a mess right now!

Link to comment
Share on other sites

For anybody who doesn't want to look at all that code but might be able to help with the navigation question - my timeline code that is giving me grief is here:

 

function createTimeline():void {
for(var i:int=0;itrace ('im trying to create a timeline');
trace('here is the pageArray ' + pageArray[i]);	
//trace('here is the page num ' + i);	

timeline.addLabel("page" + i, timeline.duration) 
timeline.append(TweenMax.from(pageArray[i], 1, {delay:2, autoAlpha:.5, onComplete:pauseMe} ) )
}
}

 

and here is my experimentation with changing pages... (not working at all - I think the autoAlpha settings are messed up as well, as I need to set the page.alpha to 1 again and autoAlpha back to 0...)

 

function goForward(event:MouseEvent):void {

trace('trying to go forward');
//timeline.gotoAndStop("page1");
timeline.killTweensOf("page1")
timeline.tweenTo("page2")
//TweenLite.to(timeline, 0.5, {time:3});

}

Link to comment
Share on other sites

For anybody who doesn't want to look at all that code but might be able to help with the navigation question - my timeline code that is giving me grief is here:

 

function createTimeline():void {
for(var i:int=0;itrace ('im trying to create a timeline');
trace('here is the pageArray ' + pageArray[i]);	
//trace('here is the page num ' + i);	

timeline.addLabel("page" + i, timeline.duration) 
timeline.append(TweenMax.from(pageArray[i], 1, {delay:2, autoAlpha:.5, onComplete:pauseMe} ) )
}
}

 

and here is my experimentation with changing pages... (not working at all - I think the autoAlpha settings are messed up as well, as I need to set the page.alpha to 1 again and autoAlpha back to 0...)

 

function goForward(event:MouseEvent):void {

trace('trying to go forward');
//timeline.gotoAndStop("page1");
timeline.killTweensOf("page1")
timeline.tweenTo("page2")
//TweenLite.to(timeline, 0.5, {time:3});

}

Link to comment
Share on other sites

I tried opening your fla but I'm running CS5.

 

i noticed that when you generated your pages you are setting

 

page.alpha = 0;

 

in your from() tweens inside your timeline it appears you are doing a tween FROM autoAlpha.5

 

that means you are going from .5 to 0 so that might explain why things might be fading out.

 

your basic setup looks pretty solid, from just looking over the code quickly, conceptually it looks like it should work.

 

I'm pretty sure if I can look at your file I can get something working. It looks like you have made tremendous progress.

Link to comment
Share on other sites

Hello Carl - I'm done!

 

Very exciting - this will make my IOS app "compile-able" versus just choking on like 1MB of unnecessary AS3.

 

Here is the new FLA - in case it helps you for any future tutorials.

 

I copped out on TimelineMax - just found it simpler to hide the pages.

 

Here is the updated file set.

 

thanks for the encouragement - I really appreciate it.

 

warm wishes

Stacey

Link to comment
Share on other sites

ah just fyi - the hiding of text on any page where the "scramble" variable is set to YES is intentional - that is because I load a sub app which uses the string in a scramble game on this pages.

 

Thanks again for the encouragement - perhaps my files will help somebody else totally new to XML loading and getting those values into Arrays that you can really work with.

Link to comment
Share on other sites

Hey Carl - I could not resist when I saw the Throw Props panel examples, and tried putting a mini slideshow into that format.

 

Looks pretty cool! I'll probably make a new activity in my IOS app for quick vocab review using this. I thought you might enjoy it - so here is a CS5 version for you.

 

warm wishes

Stacey

Link to comment
Share on other sites

  • 5 months later...

Hi,

 

Nice Project. How did you get it working? I am trying to create a FlashBuilder 4.5 ActionScript Mobile project for output to the IOS via AIR. As soon as I include LoaderMax the project will not install on the device. I have tried using the relative path to my XML file, loading the XML from a server and using the filesystem approach I have seen elsewhere. I also updated greensock as I saw suggested in another post. No luck. The emulator has no issue with any of the methods but the IPA will not load on the device.

 

Did you have any of these types of issues? Any help would be greatly appreciated. Thanks.

Link to comment
Share on other sites

Solved my own issue. At least partially. I had been using a directory named "Resources" to hold my files to be loaded. Turns out this is not a good idea.

 

From Adobe:

Important: Do not create a subdirectory in your application directory named Resources. The runtime automatically creates a folder with this name to conform to the IPA package structure. Creating your own Resources folder results in a fatal conflict.

 

http://help.adobe.com/en_US/air/build/W ... -8000.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...