TileList と UILoader を使用したフォト ギャラリーがあります。それは完全にうまく機能します。TileList のサムネイルをクリックすると、画像全体が UILoader に表示されますが、次と前のボタンを追加して、画像をナビゲートできるようにしようとしています。これを行うために関数を作成する/コードを書く方法がわかりません。ループを使用する必要がありますか? これは可能ですか?? Google で検索しましたが、答えが見つかりませんでした。[this][1] に近いものを見つけましたが、コードが提供されておらず、その質問は Flex に関するものです。
これまでの私のコードは次のとおりです。
import flash.display.Loader;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.MouseEvent;
import fl.data.DataProvider;
import fl.controls.TileList;
import fl.controls.ScrollBarDirection;
import fl.transitions.Tween;
import fl.transitions.easing.None;
var XMLgallery:XML = <items>
<item source="img/DSC_0.jpg" />
<item source="img/DSC_1.jpg" />
<item source="img/DSC_2.jpg" />
<item source="img/DSC_3.jpg" />
<item source="img/DSC_4.jpg" />
<item source="img/DSC_5.jpg" />
<item source="img/DSC_6.jpg" />
<item source="img/DSC_7.jpg" />
<item source="img/DSC_8.jpg" />
<item source="img/DSC_9.jpg" />
<item source="img/DSC_10.jpg" />
<item source="img/DSC_11.jpg" />
<item source="img/DSC_12.jpg" />
<item source="img/DSC_13.jpg" />
<item source="img/DSC_14.jpg" />
<item source="img/DSC_15.jpg" />
</items>;
tileList.dataProvider = new DataProvider(XMLgallery);
tileList.setSize(795, 130);
tileList.columnWidth = 195;
tileList.rowHeight = 130;
tileList.direction = ScrollBarDirection.HORIZONTAL;
tileList.addEventListener(Event.CHANGE, imageChanger);
progressBar.visible = false;
mainLoader.load(new URLRequest("img/DSC_0.jpg"));
function imageChanger(event:Event):void{
progressBar.visible = true;
mainLoader.source = tileList.selectedItem.source;
var myTween:Tween = new Tween(mainLoader, "alpha", None.easeNone,.3,1,18,false);
}
mainLoader.addEventListener(Event.COMPLETE, completeHandler);
function completeHandler(event:Event):void{
progressBar.visible = false;
}
prev_mc.addEventListener(MouseEvent.CLICK, prevF);
next_mc.addEventListener(MouseEvent.CLICK, nextF);