summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/media9/players/SlideShow.mxml
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/media9/players/SlideShow.mxml')
-rw-r--r--Master/texmf-dist/source/latex/media9/players/SlideShow.mxml94
1 files changed, 77 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/media9/players/SlideShow.mxml b/Master/texmf-dist/source/latex/media9/players/SlideShow.mxml
index 6d7087bbc70..743d482602d 100644
--- a/Master/texmf-dist/source/latex/media9/players/SlideShow.mxml
+++ b/Master/texmf-dist/source/latex/media9/players/SlideShow.mxml
@@ -4,7 +4,7 @@
<!-- a FlashPlayer-10 compatible component for -->
<!-- JPEG/PNG/GIF slideshows. -->
<!-- -->
-<!-- version 20150511 -->
+<!-- version 20150601 -->
<!-- -->
<!-- -->
<!-- The free Apache Flex 4 SDK is required to compile -->
@@ -38,8 +38,9 @@
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
- preinitialize="initialise(FlexGlobals.topLevelApplication.parameters);"
+ preinitialize="initialise(this.parameters);"
applicationComplete="initApp();"
+ resize="if(dynResolution){dynResolution=false;forcedByUsr=true;setImgSrc();}"
backgroundAlpha="0"
>
<fx:Script>
@@ -73,15 +74,15 @@
{
slideshowXML = new XML(loader.data);
setXMLDone=true;
+ rotations=new Object();
seek(0);
if(autoPlay) play();
}
}
- import mx.core.FlexGlobals;
[Bindable] private var delay:Number=5;
[Bindable] private var autoPlay:Boolean=false;
- private var xmlfile:String;
+ private var xmlfile:String=null;
private function initialise(flashVars:Object):void {
xmlfile=flashVars.xml;
@@ -95,6 +96,7 @@
private var curFile:String;
private var idx:Number=0;
+ private var urlIdx:Number=0;
[Bindable] private var src1:String;
[Bindable] private var src2:String;
@@ -104,15 +106,22 @@
if(Img1.visible){
n==0 ? Img1.rotation=0 : Img1.rotation+=90*Math.floor(n);
Img1.rotation%=360;
- rotations[slideshowXML.Img[idx].URL.toString()]=Img1.rotation/90;
+ rotations[slideshowXML.Img[idx].URL[urlIdx].toString()]=
+ Img1.rotation/90;
} else {
n==0 ? Img2.rotation=0 : Img2.rotation+=90*Math.floor(n);
Img2.rotation%=360;
- rotations[slideshowXML.Img[idx].URL.toString()]=Img2.rotation/90;
+ rotations[slideshowXML.Img[idx].URL[urlIdx].toString()]=
+ Img2.rotation/90;
}
}
+ import mx.collections.ArrayCollection;
+ import spark.collections.Sort;
+ import spark.collections.SortField;
+
private var forcedByUsr:Boolean;
+ private var dynResolution:Boolean;
private function setImgSrc():void {
if(reloadTimer && reloadTimer.hasEventListener(TimerEvent.TIMER)){
@@ -126,7 +135,57 @@
CursorManager.setBusyCursor();
timeoutTimer.start();
isIOError=true;
- curFile=slideshowXML.Img[idx].URL.toString();
+
+ urlIdx=0;
+ if(slideshowXML.Img[idx].URL.length()>1){
+ var sizes:ArrayCollection = new ArrayCollection();
+ for(var i:Number=0; i<slideshowXML.Img[idx].URL.length(); i++){
+ var sizeStr:String=slideshowXML.Img[idx].URL[i].attribute("size");
+ if(sizeStr.match(/^\s*[0-9]+x[0-9]+\s*$/)){
+ var xsize:Number=Number(sizeStr.replace(/x[0-9]+/, ""));
+ var ysize:Number=Number(sizeStr.replace(/[0-9]+x/, ""));
+ sizes.addItem(
+ {size: xsize*ysize, index: i, x: xsize, y: ysize});
+ }
+ }
+ if(sizes.length>0){
+ dynResolution=true;
+ var sort:Sort = new Sort();
+ sort.fields=[new SortField("size",true,true)];
+ sizes.sort=sort;// ^--descending order
+ sizes.refresh();
+
+ urlIdx=sizes.getItemAt(0).index;
+ for(i=0; i<sizes.length; i++){
+ if(
+ sizes.getItemAt(i).x >= this.width ||
+ sizes.getItemAt(i).y >= this.height
+ ) urlIdx=sizes.getItemAt(i).index;
+ }
+ }
+ }
+
+ curFile=slideshowXML.Img[idx].URL[urlIdx].toString();
+
+ var pattern:RegExp;
+ if(slideshowXML.Img[idx].URL[urlIdx].attribute('height').length() > 0){
+ pattern = new RegExp(
+ slideshowXML.Img[idx].URL[urlIdx].attribute('height'), "g");
+ if(curFile.search(pattern)>-1){
+ dynResolution=true;
+ curFile=curFile.replace(pattern, this.toString());
+ }
+ }
+
+ if(slideshowXML.Img[idx].URL[urlIdx].attribute('width').length() > 0){
+ pattern = new RegExp(
+ slideshowXML.Img[idx].URL[urlIdx].attribute('width'), "g");
+ if(curFile.search(pattern)>-1){
+ dynResolution=true;
+ curFile=curFile.replace(pattern, this.width.toString());
+ }
+ }
+
if(Img1.visible) {
src2=null; src2=curFile;
} else {
@@ -305,10 +364,10 @@
}
});
- rotations=new Object();
timeoutTimer=new Timer(30000, 1);
timeoutTimer.addEventListener(TimerEvent.TIMER, onAnyError);
- curFile=xmlfile; setXML(xmlfile);
+ curFile=xmlfile; if(xmlfile) setXML(xmlfile);
+ CursorManager.hideCursor();
}
private var isIOError:Boolean;
@@ -322,7 +381,7 @@
src1=null; src1="/dev/null"
}
caption.text=e.type+': '+curFile;
- if(caption.text==TimerEvent.TIMER)
+ if(e.type==TimerEvent.TIMER)
caption.text="timeout after 30 s: "+curFile;
CursorManager.removeBusyCursor();
}else{
@@ -350,8 +409,8 @@
slideNo.visible=slideNo.includeInLayout=false;
}
var curRot:Number=0;
- if (rotations.hasOwnProperty(slideshowXML.Img[idx].URL.toString()))
- curRot=rotations[slideshowXML.Img[idx].URL.toString()];
+ if (rotations.hasOwnProperty(slideshowXML.Img[idx].URL[urlIdx].toString()))
+ curRot=rotations[slideshowXML.Img[idx].URL[urlIdx].toString()];
else
curRot=Number(slideshowXML.Img[idx].attribute('rot90'));
rotate(0);
@@ -363,10 +422,10 @@
} else {
caption.text="";
caption.visible=false;
- }
- if(!isReload) anim.play();
+ }
+ if(!isReload) anim.play();
if(slideshowXML.Img[idx].attribute('live')>0)
- cache.removeCacheEntry(slideshowXML.Img[idx].URL.toString());
+ cache.removeCacheEntry(curFile);
}
CursorManager.removeBusyCursor();
isEnabled=true;
@@ -420,7 +479,8 @@
<s:Button alpha="0" width="100%" height="100%"
mouseUp="forcedByUsr=true;nextSlide(event);"
- mouseOver="anim.play();"
- mouseOut="if(anim.isPlaying) anim.reverse(); else anim.play(null,true);"
+ mouseOver="anim.play();CursorManager.showCursor();"
+ mouseOut="if(anim.isPlaying) anim.reverse(); else anim.play(null,true);
+ CursorManager.hideCursor();"
/>
</s:Application>