Thumbnail Array
I'm trying to create a simple strip of thumbnails, here's my code
Code: package DocumentClass{ import flash.display.*; import flash.net.*; public class DocumentClass extends MovieClip { var thumbStrip:Array=new Array(); public function DocumentClass() { var thumb:Thumb; var xcur:uint= 10; var ycur:uint = 10; var thumbPath:String; var myLoader:Loader = new Loader(); var i:uint; for (i=0; i<5; i++) { thumb=new Thumb(); thumb.x=xcur; thumb.y=ycur; xcur+=40; var _request:URLRequest = new URLRequest("thumbs/"+i+".png"); myLoader.load(_request); thumbStrip.push(thumb); thumb.addChild(myLoader); addChild(thumb); } } } } The problem is that only the last thumbnail is appearing, it's like there can only be one instance of thumb. In AS2.0 I might refer to the thumbs like this
Code: _root["thumb"+i]._x=curx; However I can't seem to get this working in AS3.0 when I try, can anyone help?
ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0
Posted on: 06-19-2008, 08:19 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
[CS3] Refresh Thumbnail Array In EventListener?
Hi there,
I'm building a thumbnail gallery with XML in combination with a Tree menu.
When clicking one of the Treenodes, the appropiate thumbnails should be loaded in an array. When clicking one of the thumnails the large image gets loaded.
Well, this is going great, but I have two questions/problems which need to be solved;
1) If you click Treenode 1 for example, which has 5 images/thumbnails, the thumbnails get loaded, but when you click Treenode 2, which only has 2 images/thumbnails, the last 3 thumbnails stay visible.....
So everytime you click on one of the Treenodes, the thumbnail array should get refreshed or something like that? How do I do that?
2) Second question; I actually don't wanna use thumnail images, but an icon which is in my library with a Linkage Identifier named thumb_icon, as thumbnail image. How do I achieve that in my script?
I tried:
PHP Code:
image_mcl.attachMovie("thumb_icon", "Thumbnailicon", getNextHighestDepth());
Instead of:
PHP Code:
image_mcl.loadClip("content/projects/thumb_icon.swf","detail_mc.thumbnails_mc.t"+k);
But that doesn't work...
Could anyone take a look at my script?
This is my entire actionscript:
PHP Code:
//Tree menu uit XML laden
graphicXML = new XML();
graphicXML.ignoreWhite = true;
graphicXML.onLoad = function(success) {
if (success) {
tofillTreeGraphicdesign();
} else {
trace("The XML could not be loaded");
}
};
graphicXML.load("content/content.xml");
import mx.transitions.Tween;
import mx.transitions.easing.*;
var DetailBox;
var statusDetail = "onzichtbaar";
function tofillTreeGraphicdesign() {
//Atach masters the component
attachMovie("Tree","graphicdesign",1);
graphicdesign.move(19,23);
graphicdesign.vScrollPolicy = "off";
//Style Tree
graphicdesign.rowHeight = 18;
graphicdesign.setStyle("fontSize",8);
graphicdesign.setStyle("fontFamily","Bavaria Regular");
graphicdesign.setStyle("fontWeight","normal");
graphicdesign.embedFonts = true;
graphicdesign.setStyle("selectionColor",0x000000);
graphicdesign.setStyle("textSelectedColor",0xFFFFFF);
//We filled the menu
graphicdesign.dataProvider = graphicXML.firstChild.childNodes[1].childNodes[0];
//Auto height Tree
var TreeHeight = (graphicXML.firstChild.childNodes[1].childNodes[0].childNodes.length)*18;
graphicdesign.setSize(140,TreeHeight);
//Auto visibility scroller
scrollgraphic.scrollTarget = graphicdesign;
if (graphicXML.firstChild.childNodes[1].childNodes[0].childNodes.length>=5) {
scrollgraphic._visible = true;
} else {
scrollgraphic._visible = false;
}
//event objects
graphicdesign.addEventListener("change",listChanged_G);
}
listChanged_G = new Object();
listChanged_G.change = function(evt_obj) {
var node = evt_obj.target.selectedNode;
//If it is a folder…
if (graphicdesign.getIsBranch(node)) {
//Deselecting other tree nodes
spatialdesign.selectedNode = null;
otherworks.selectedNode = null;
//If this is a branch
var Client = node.childNodes[0].firstChild;
var Year = node.childNodes[1].firstChild;
var Medium = node.childNodes[2].firstChild;
var Desc = node.childNodes[3].firstChild;
//Images
image = [];
//Clear thumbnails
unloadMovie("detail_mc.thumbnails_mc.t"+k);
thumbnails = [];
total = node.childNodes[4].childNodes.length;
for (i=0; i<total; i++) {
image[i] = node.childNodes[4].childNodes[i].firstChild.nodeValue;
thumbnails[i] = node.childNodes[4].childNodes[i].firstChild.nodeValue;
thumbnails_fn(i);
}
//Fill textboxes
detail_mc.client.text = Client;
detail_mc.year.text = Year;
detail_mc.medium.text = Medium;
detail_mc.description.xmltext.text = Desc;
//Slide detail out
detail_mc._visible = true;
if (statusDetail == "onzichtbaar") {
DetailBox = new Tween (detail_mc,"_y",Strong.easeInOut,(detail_mc._y)-150,detail_mc._y,32,false);
statusDetail = "zichtbaar";
trace(statusDetail);
} else {
}
//Load first image
firstImage();
} else {
}
};
//Functions
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[p], 1);
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[p], 1);
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[0],1);
}
}
function picture_num() {
current_pos = p+1;
}
//Preloader
this.onEnterFrame = function() {
filesize = _root.picholder.getBytesTotal();
loaded = _root.picholder.getBytesLoaded();
_root.preloader._visible = true;
if (loaded != filesize) {
_root.preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
_root.preloader._visible = false;
if (_root.picholder._alpha<100) {
_root.picholder._alpha += 10;
}
}
};
//Scroll Thumbnails
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=detail_mc.thumbnails_mc._y) && (_root._ymouse<=detail_mc.thumbnails_mc._y+detail_mc.thumbnails_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (detail_mc.thumbnails_mc.hitTest(detail_mc.hit_right))) {
detail_mc.thumbnails_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (detail_mc.thumbnails_mc.hitTest(detail_mc.hit_left))) {
detail_mc.thumbnails_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
//Fill thumbnails
function thumbnails_fn(k) {
detail_mc.thumbnails_mc.createEmptyMovieClip("t"+k,detail_mc.thumbnails_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = detail_mc.hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
//image_mcl.attachMovie("thumb_icon", "Thumbnailicon", getNextHighestDepth());
image_mcl.loadClip("content/projects/thumb_icon.swf","detail_mc.thumbnails_mc.t"+k);
}
//Thumnail actions
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
Many thanks!
Refresh Thumbnail Array In EventListener?
Hi there,
I'm building a thumbnail gallery with XML in combination with a Tree menu, using this Kirupa tutorial: http://www.kirupa.com/developer/mx2004/thumbnails.htm
When clicking one of the Treenodes, the appropiate thumbnails should be loaded in an array. When clicking one of the thumnails the large image gets loaded.
Well, this is going great, but I have two questions/problems which need to be solved;
1) If you click Treenode 1 for example, which has 5 images/thumbnails, the thumbnails get loaded, but when you click Treenode 2, which only has 2 images/thumbnails, the last 3 thumbnails stay visible.....
So everytime you click on one of the Treenodes, the thumbnail array should get refreshed or something like that? How do I do that?
2) Second question; I actually don't wanna use thumnail images, but an icon which is in my library with a Linkage Identifier named thumb_icon, as thumbnail image. How do I achieve that in my script?
I tried:
Code:
image_mcl.attachMovie("thumb_icon", "Thumbnailicon", getNextHighestDepth());
Instead of:
Code:
image_mcl.loadClip("content/projects/thumb_icon.swf","detail_mc.thumbnails_mc.t"+k);
But that doesn't work...
Could anyone take a look at my script?
This is my entire actionscript:
Code:
//Tree menu uit XML laden
graphicXML = new XML();
graphicXML.ignoreWhite = true;
graphicXML.onLoad = function(success) {
if (success) {
tofillTreeGraphicdesign();
} else {
trace("The XML could not be loaded");
}
};
graphicXML.load("content/content.xml");
import mx.transitions.Tween;
import mx.transitions.easing.*;
var DetailBox;
var statusDetail = "onzichtbaar";
function tofillTreeGraphicdesign() {
//Atach masters the component
attachMovie("Tree","graphicdesign",1);
graphicdesign.move(19,23);
graphicdesign.vScrollPolicy = "off";
//Style Tree
graphicdesign.rowHeight = 18;
graphicdesign.setStyle("fontSize",8);
graphicdesign.setStyle("fontFamily","Bavaria Regular");
graphicdesign.setStyle("fontWeight","normal");
graphicdesign.embedFonts = true;
graphicdesign.setStyle("selectionColor",0x000000);
graphicdesign.setStyle("textSelectedColor",0xFFFFFF);
//We filled the menu
graphicdesign.dataProvider = graphicXML.firstChild.childNodes[1].childNodes[0];
//Auto height Tree
var TreeHeight = (graphicXML.firstChild.childNodes[1].childNodes[0].childNodes.length)*18;
graphicdesign.setSize(140,TreeHeight);
//Auto visibility scroller
scrollgraphic.scrollTarget = graphicdesign;
if (graphicXML.firstChild.childNodes[1].childNodes[0].childNodes.length>=5) {
scrollgraphic._visible = true;
} else {
scrollgraphic._visible = false;
}
//event objects
graphicdesign.addEventListener("change",listChanged_G);
}
listChanged_G = new Object();
listChanged_G.change = function(evt_obj) {
var node = evt_obj.target.selectedNode;
//If it is a folder…
if (graphicdesign.getIsBranch(node)) {
//Deselecting other tree nodes
spatialdesign.selectedNode = null;
otherworks.selectedNode = null;
//If this is a branch
var Client = node.childNodes[0].firstChild;
var Year = node.childNodes[1].firstChild;
var Medium = node.childNodes[2].firstChild;
var Desc = node.childNodes[3].firstChild;
//Images
image = [];
//Clear thumbnails
unloadMovie("detail_mc.thumbnails_mc.t"+k);
thumbnails = [];
total = node.childNodes[4].childNodes.length;
for (i=0; i<total; i++) {
image[i] = node.childNodes[4].childNodes[i].firstChild.nodeValue;
thumbnails[i] = node.childNodes[4].childNodes[i].firstChild.nodeValue;
thumbnails_fn(i);
}
//Fill textboxes
detail_mc.client.text = Client;
detail_mc.year.text = Year;
detail_mc.medium.text = Medium;
detail_mc.description.xmltext.text = Desc;
//Slide detail out
detail_mc._visible = true;
if (statusDetail == "onzichtbaar") {
DetailBox = new Tween (detail_mc,"_y",Strong.easeInOut,(detail_mc._y)-150,detail_mc._y,32,false);
statusDetail = "zichtbaar";
trace(statusDetail);
} else {
}
//Load first image
firstImage();
} else {
}
};
//Functions
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[p], 1);
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[p], 1);
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
_root.picholder._alpha = 0;
_root.picholder.loadMovie(image[0],1);
}
}
function picture_num() {
current_pos = p+1;
}
//Preloader
this.onEnterFrame = function() {
filesize = _root.picholder.getBytesTotal();
loaded = _root.picholder.getBytesLoaded();
_root.preloader._visible = true;
if (loaded != filesize) {
_root.preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
_root.preloader._visible = false;
if (_root.picholder._alpha<100) {
_root.picholder._alpha += 10;
}
}
};
//Scroll Thumbnails
function thumbNailScroller() {
// thumbnail code!
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 10;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=detail_mc.thumbnails_mc._y) && (_root._ymouse<=detail_mc.thumbnails_mc._y+detail_mc.thumbnails_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (detail_mc.thumbnails_mc.hitTest(detail_mc.hit_right))) {
detail_mc.thumbnails_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (detail_mc.thumbnails_mc.hitTest(detail_mc.hit_left))) {
detail_mc.thumbnails_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}
//Fill thumbnails
function thumbnails_fn(k) {
detail_mc.thumbnails_mc.createEmptyMovieClip("t"+k,detail_mc.thumbnails_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = detail_mc.hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
//image_mcl.attachMovie("thumb_icon", "Thumbnailicon", getNextHighestDepth());
image_mcl.loadClip("content/projects/thumb_icon.swf","detail_mc.thumbnails_mc.t"+k);
}
//Thumnail actions
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
Any help is very much appreciated!
Many thanks!
Loading Full Image & Text From Thumbnail (Array)
Hey, little bit before I post the code.
Anyway, I'm moving from AS2 to AS3 and always wanted to make an XML (or in this case RSS) feeder much like the one seen on websites like IGN.com
Anyway, I'm sure this isn't the best way going about it but its part of my slow, self-learning process. I've basically done it before on AS2 but as you know, much is different and really even the same principles are no longer useful here from my old code.
Anyway, my thumbnails load great and the way I have it set up, when the thumbnail is clicked (with p for the number) it will only load the LAST image and title etc...however, when I use [i] it comes back undefined.
Basically, I'm sure its easy but I've looked at it for so long now and gone about this thing 3 different ways before ending up at this point, that I am probably missing it. I just want when I click the thumbnail, the correct (either using i or p, I don't care) image, title and link (when I add it in) will load.
Eventually I'll make the thumbnails scroll sideways, one thumbnail at a time and will need help on making that loop or stop once I get there, but right now I need to get this up so I can finish the rest of the site.
I'm really starting to love AS3 but still need to get a handle on creating event handlers and the new for loops etc.
Code:
var rssLoader:URLLoader = new URLLoader();
var rssURL:URLRequest = new URLRequest("http://awf.brandon-jackson.com/news/rss.php?number=5");
rssLoader.addEventListener(Event.COMPLETE, rssLoaded);
rssLoader.load(rssURL);
var rssXML:XML = new XML();
rssXML.ignoreWhitespace = true;
function rssLoaded(evt:Event): void {
rssXML = XML(rssLoader.data);
titleText.htmlText = rssXML.channel.item.title[i];
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest(rssXML.channel.item.graphic[i]));
mainPicture.addChild(imageLoader);
for (var i:uint=0; i<3; i++) {
var thumbMC:MovieClip = new MovieClip();
var thumbLoader:Loader = new Loader();
thumbMC.graphics.beginFill(0)
thumbMC.graphics.drawRect(0, 0, 100, 100);
thumbMC.graphics.endFill();
thumbMC.x = i * 100;
thumbMC.y = 2.5;
//thumbMC.addEventListener(MouseEvent.CLICK, clickHandler);
thumbLoader.load(new URLRequest(rssXML.channel.item.thumbnail[i]));
thumbLoader.x += i * (100 +5);
thumbLoader.y = 2.5;
thumbScroller.addChild(thumbLoader);
thumbScroller.buttonMode = true;
trace (i);
/*thumbScroller.addChild(thumbMC);
thumbMC.buttonMode = true;
thumbLoader.load(new URLRequest(rssXML.channel.item.thumbnail[i]));*/
}
var p:uint = i;
thumbScroller.addEventListener(MouseEvent.CLICK, thumbClick);
function thumbClick(event:MouseEvent):void {
//imageLoader.load(new URLRequest(rssXML.channel.item.graphic[p]));
//titleText.htmlText = rssXML.channel.item.title[i];
trace(rssXML.channel.item.graphic[p]);
}
}
Loading Full Image & Text From Thumbnail (Array)
Hey, little bit before I post the code.
Anyway, I'm moving from AS2 to AS3 and always wanted to make an XML (or in this case RSS) feeder much like the one seen on websites like IGN.com
Anyway, I'm sure this isn't the best way going about it but its part of my slow, self-learning process. I've basically done it before on AS2 but as you know, much is different and really even the same principles are no longer useful here from my old code.
Anyway, my thumbnails load great and the way I have it set up, when the thumbnail is clicked (with p for the number) it will only load the LAST image and title etc...however, when I use [i] it comes back undefined.
Basically, I'm sure its easy but I've looked at it for so long now and gone about this thing 3 different ways before ending up at this point, that I am probably missing it. I just want when I click the thumbnail, the correct (either using i or p, I don't care) image, title and link (when I add it in) will load.
Eventually I'll make the thumbnails scroll sideways, one thumbnail at a time and will need help on making that loop or stop once I get there, but right now I need to get this up so I can finish the rest of the site.
I'm really starting to love AS3 but still need to get a handle on creating event handlers and the new for loops etc.
Code:
var rssLoader:URLLoader = new URLLoader();
var rssURL:URLRequest = new URLRequest("http://awf.brandon-jackson.com/news/rss.php?number=5");
rssLoader.addEventListener(Event.COMPLETE, rssLoaded);
rssLoader.load(rssURL);
var rssXML:XML = new XML();
rssXML.ignoreWhitespace = true;
function rssLoaded(evt:Event): void {
rssXML = XML(rssLoader.data);
titleText.htmlText = rssXML.channel.item.title[i];
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest(rssXML.channel.item.graphic[i]));
mainPicture.addChild(imageLoader);
for (var i:uint=0; i<3; i++) {
var thumbMC:MovieClip = new MovieClip();
var thumbLoader:Loader = new Loader();
thumbMC.graphics.beginFill(0)
thumbMC.graphics.drawRect(0, 0, 100, 100);
thumbMC.graphics.endFill();
thumbMC.x = i * 100;
thumbMC.y = 2.5;
//thumbMC.addEventListener(MouseEvent.CLICK, clickHandler);
thumbLoader.load(new URLRequest(rssXML.channel.item.thumbnail[i]));
thumbLoader.x += i * (100 +5);
thumbLoader.y = 2.5;
thumbScroller.addChild(thumbLoader);
thumbScroller.buttonMode = true;
trace (i);
/*thumbScroller.addChild(thumbMC);
thumbMC.buttonMode = true;
thumbLoader.load(new URLRequest(rssXML.channel.item.thumbnail[i]));*/
}
var p:uint = i;
thumbScroller.addEventListener(MouseEvent.CLICK, thumbClick);
function thumbClick(event:MouseEvent):void {
//imageLoader.load(new URLRequest(rssXML.channel.item.graphic[p]));
//titleText.htmlText = rssXML.channel.item.title[i];
trace(rssXML.channel.item.graphic[p]);
}
}
Image Gallery Thumbnail OnRelease Array Or XML Loading Problem
I'm using Flash CS3, but this project began in 8 and uses AS 1 and 2, so I figured this was the more appropriate section.
So I have a basic photo album for prototyping that is populated by values from an XML file. There are 9 maximum thumbnails (3 x 3) in each album. This all works.
Upon onRelease of each thumbnail a pop up larger-view movie clip appears to display the respective larger image. The viewer movie clip appears fine and in the correct position. The problem is the larger image does not get loaded into the holder clip within the viewer. Output is telling me that the value that I'm pulling from the XML file is undefined.
Both the thumbs and the larger images are using the same XML file and the same array. All of the pertinent code is within a class. All the correct files are in the folder they should be in. It is not a file not found error. Typos have been accounted for. The code for populating the thumbs is almost identical to the code for the larger image. It's just that one works, and the other doesn't.
Code:
class Photos extends MovieClip {
//
public var a:Number;
public var i:Number;
//
public function Photos() {
//load in XML
_root.photoXML = new XML();
_root.photoXML.ignoreWhite = true;
_root.photoXML.load("xmlData/photos.xml");
_root.photoXML.onLoad = function(success){
if(success) {
this.XmlConnect();
}
}
}
public function goPhotos() {
//
//First build arrays:
_root.photosArray = new Array();
_root.totalPhotos = _root.photoXML.childNodes[0].childNodes.length;
// fill arrays ::
for (a=0; a<_root.totalPhotos; a++) {
if(_root.photoXML.childNodes[0].childNodes[a].attributes.blockNum == _root.blockNum and _root.photoXML.childNodes[0].childNodes[a].attributes.locNum == _root.locNum+1) {
_root.photosArray.push({photoName:_root.photoXML.c hildNodes[0].childNodes[a].attributes.title, photoFile:_root.photoXML.childNodes[0].childNodes[a].attributes.filename});
}
}
trace("photosArray length = "+_root.photosArray.length);
//
for(a=0;a<10;a++) {
_root.detail.photoSec.photosHolder["img"+a].img._alpha = 0;
_root.detail.photoSec.photosHolder["img"+a].img._visible = false;
}
//
for(a=0;a<_root.photosArray.length;a++) {
_root.detail.photoSec.photosHolder["img"+a].img.loadMovie("images/sm_"+_root.photosArray[a].photoFile+".jpg",a);
_root.detail.photoSec.photosHolder["img"+a].img._visible = true;
_root.detail.photoSec.photosHolder["img"+a].img._alpha = 100;
}
//
//
//
_root.detail.audioSec.vLoader.vHolder.unloadMovie( );
_root.detail.audioSec.audioControlsHolder.vStat.gr abBar._x = 0;
_root.detail.audioSec.vLoader.gotoAndStop(1);
//
//
//
}
public function hidePhotos() {
for(i=0;i<_root.photosArray.length;i++) {
_root.detail.photoSec.photosHolder["img"+i].enabled = false;
}
}
public function showPhotos() {
for(i=0;i<_root.photosArray.length;i++) {
_root.detail.photoSec.photosHolder["img"+i].enabled = true;
}
}
public function launchLargePhotoViewer(photoNum) {
/*_root.detail.photoSec.photosHolder["img"+_root.locNum].onRelease=function():Void {
_root.detail.largeViewerHolder.removeMovieClip();
_root.detail.createEmptyMovieClip("largeViewerHolder", _root.detail.getNextHighestDepth());
_root.detail.largeViewerHolder.attachMovie("largeViewer", "largeViewer"+i, _root.detail.largeViewerHolder.getNextHighestDepth (), {_x: 251.1, _y:-27.9});
_root.detail.largeViewerHolder["largeViewer"+i].createEmptyMovieClip("img", _root.detail.largeViewerHolder["largeViewer"+i].getNextHighestDepth());
_root.detail.largeViewerHolder["largeViewer"+i].img.loadMovie("images/md_"+_root.photosArray[i].photoFile+".jpg", i);
_root.detail.largeViewerHolder["largeViewer"+i].img._x = _root.detail.largeViewerHolder["largeViewer"+i]._x + (_root.detail.largeViewerHolder._width - _root.detail.largeViewerHolder["largeViewer"+i].pic._width)*.5;
_root.detail.largeViewerHolder["largeViewer"+i].img._y = _root.detail.largeViewerHolder["largeViewer"+i]._y + (_root.detail.largeViewerHolder._height - _root.detail.largeViewerHolder["largeViewer"+i].pic._height)*.5;
}*/
for (i=0;i<_root.photosArray.length;i++) {
_root.detail.photoSec.photosHolder["img"+i].onRelease=function():Void {
_root.detail.largeViewerHolder.removeMovieClip();
_root.detail.createEmptyMovieClip("largeViewerHolder", _root.detail.getNextHighestDepth());
_root.detail.largeViewerHolder.attachMovie("largeViewer", "largeViewer"+i, _root.detail.largeViewerHolder.getNextHighestDepth (), {_x: 251.1, _y:-27.9});
_root.detail.largeViewerHolder["largeViewer"+i].createEmptyMovieClip("img", _root.detail.largeViewerHolder["largeViewer"+i].getNextHighestDepth());
_root.detail.largeViewerHolder["largeViewer"+i].img.loadMovie("images/md_"+_root.photoXML.childNodes[0].childNodes[i].attributes.filename+".jpg", i);
_root.detail.largeViewerHolder["largeViewer"+i].img._x = _root.detail.largeViewerHolder["largeViewer"+i]._x + (_root.detail.largeViewerHolder._width - _root.detail.largeViewerHolder["largeViewer"+i].pic._width)*.5;
_root.detail.largeViewerHolder["largeViewer"+i].img._y = _root.detail.largeViewerHolder["largeViewer"+i]._y + (_root.detail.largeViewerHolder._height - _root.detail.largeViewerHolder["largeViewer"+i].pic._height)*.5;
}
}
}
}
I appreciate any insight into this conundrum.
ETA: photoFile is the culprit of 'undefined'
Xml Thumbnail Gallery - How To Leave Thumbnail Blank?
There was a thread a few days ago on how to leave the caption or description blank. If anyone knows could you explain how to leave the thumbnail and/or url blank for some and to show for others? Where if there is no information that flash can read a field that is undefined as ""?
FLV Video Thumbnail + Thumbnail Gallery With LinkIDs From XML
Let's say for instance, our XML file:
<videos>
<video linkid="AK0001" thumb="http://www.site.com/pathtofile/filename.flv">
<link>http://www.site.com/pathtofile/filename.flv</link>
</video>
</videos>
Is it possible to use the source flv file as the thumbnail? Or, is it better to create a thumbnail of all the content?
With this said, how would I create the event handler to satisfy when each thumbnail is clicked, it stores it's linkid in the $_GET variable?
Thank You,
b0gui
Thumbnail Scroller With Titles For Each Thumbnail
I've got a tutorial from kirupa (http://www.kirupa.com/developer/mx2004/thumbnails.htm)
what i'm trying to do is give ech thumbnail a title below its image but i cant manage to do it. I think I know hat i need to do, that is assign/createe a dynamic text field within the image_mc and assign the title from the array at the beginning. But i cant seem to get it to work
i can do it if i just put a text field on the main time line but then this is only the title for one
heres the code for the thumbnails:
Code:
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(eval("thumbnail_mc.t"+k)._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
can any one help?
Much appreciated
Thumbnail Scroller With Titles For Each Thumbnail
I'm trying to modify the Gallery with a thumbnail scroller thats on here.
What I want to do is add it so that each thumbnail has a title below it as well.
Does anyone know if this has been covered anywhere? i@ve spent the weekend searching google and here and i'm at my wits end now..
Any help or pointers much appreciated.
Cheers in advance
Array, Array HELP - Importing A External File Into N ARRAY - Almost There
I am reading and external file with the following code:
ActionScript Code:
on (release, keyPress "<Enter>") {
lv = new LoadVars();
lv.onLoad = function() {
questions1 = this.filelist0.split(",");
answers1 = this.filelist1.split(",");
for(i=0;i<questions1.length;i++)
//trace(questions1[i]+" "+answers1[i]);
trace(questions1[i]);
//assumes same number of scores in each list
};
lv.load("questions.txt");
}
When I parse the file it puts it into an columar format as it should...however I need it to look like this:
questions1=new Array ("2+4=?","What is the capital of Illinois?","What color is the sky?","10x(5+2)=?");
answers1=new Array ("8","springfield","blue","70");
How do I do that?
Text file look like this:
&questions1=2+4=?,What is the Capital of Illinois?,What color is the sky?,10x(5+2)=?")&
&answers1=8,springfield,blue,70&
Pls Help: Need To Create New Array Taking 3 Random Entries From An Existing Array
Hello
I have a 2d array:
qTeeth[1] = [How many teeth do we have?, 1-10, 11-20, 21-30, 11-20]
etc.
It goes [question, option1, option2, option3, real answer]
I now just want to extract 3 or so of these entries and create a new array with them. Since I want to just use 3 or so questions randomly from a large array of questions.
Does anyone know a good tidy script to do this with??
Thanks in advance,
Ben.
Array Text Into Textfield And Creating New Line For Each Array Element
I have an array called dropTarg1 which stores dropped-in items.
I want to loop through this array and in a textfield, display each array item on a new line of this text field
I think I need to use something like Array.join("/n") but I can't get it working properly. I hope that the /n would create a new line of the text field called reviewBoxContentText.
for(var i:Number = 0; i<dropTarg.length; i++){
with(reviewBoxContent.reviewBoxContentText){
autoSize = true;
text = dropTarg1.join("/n");
}
}
All that is happening though is that the text field displays on a single line with /n in between each array element.
Calling A Function With An Array Variable As Arguments Is Resetting Array?
I'm going to post the full code of the two functions, disregard the "fluff" unrelated to the two functions as it is all working flawless, I've tested this HEAVILY and cannot understand why it keeps setting the entire array to undefined!
Any help would be grateful.
ActionScript Code:
// processReplace Function function processReplace(transferFiles) { var processArray:Array = transferFiles.slice(); var fileName:String = new String(); var filesArray:Array = new Array(); var replaceArray:Array = new Array(); var exists:String = new String(); var error:String = new String(); var promptResult:String = new String(); // Check for (i=0; i<processArray.length; i++) { // This is where it bugs up <b>exists = processSearch(transferFiles[i][1]);</b> if (exists == "replace") { replaceArray.push(processArray[i]); } else { filesArray.push(processArray[i]); } } // Prompt if (replaceArray.length>0) { error = "Replace "+replaceArray.length+" item(s):
"; for (i=0; i<replaceArray.length; i++) { error += " - "+replaceArray[i][1]+"
"; } promptResult = mSystem.messageBox(error, "Replace Existing Files?", 4); } // Action if (promptResult == "NO") { transferFiles = filesArray; } else if (promptResult == "YES") { transferFiles = filesArray.concat(replaceArray); } processTransfer(transferFiles); }
The processSearch
ActionScript Code:
// == processSearch Function function processSearch(sentInfo) { for (i=0; i<_global.boxFiles.length; i++) { if (_global.boxFiles[i] == sentInfo[1]) { return "replace"; break; } } }
Basically it's supposed to check to see if the file exists and return as true if it does and add it to a replace array, then the replace array is processed into a single string and put into a dialog box through the flash wrapper prompting them to "replace the files or not".
It makes the replace array just fine, it actually even has the right "count" in it but it's setting all the "filenames" to undefined because of the exists = processSearch function.
I even tried to make a new array and run the search just from that one and set the values from the old one and it's still failing.
Is it because of the "break" or can anyone figure it out? Iknow it's hard because you can't use the code
ANY Solution ideas are welcome, even if you think it's dumb
Thanks!
Thumbnail
Hi
How do you create a thumbnail of your main page of a website.
For example i want to show my portfolio and i want thumbnail of each website i created. how is that created.
thanks
Thumbnail? Please HELP
What up everyone
I'm tring to make a thumbnail gallery in flash MX. I have 10 thumbnails . When they are clicked I would like the image to be opened in a new window . I can't seem to find any tutorials on this , all I've found are tutorials on slideshows . I did find a tutorial on a pop up window that helped alittle . but it only worked with one thumbnail.
I used this script for the TN
on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "http://www.paint.html";
target_winName = "olddirtydermot";
width = 800;
height = 500;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}
then put a new layer and put this script
_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL("javascript:window.open('"+url+"','"+winNam e+"','"+"width="+w+",height="+h+",toolbar="+toolba r+",location="+location+",directories="+directorie s+",status="+status+",menubar="+menubar+",scrollba rs="+scrollbars+",resizable="+resizable+",top='+(( screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"');void(0);");
};
This only works with the first TN
I'm going about this the wrong way but I was hoping someone could piont me toward a tutorial or anything that would help
thanks for your time
Thumbnail
Can anyone know of a tutorial to make a thumbnail in flash from an external .jpg
or if it is evin possible?
Thumbnail Help
Can anyone advise as to how I go about making the type of thumbnail lists as seen on flashlevel.com? I am a graphic designer looking to put a portfolio on-line and plan to create it in flash. I am very new to flash and want to have previous work of mine listed like the thumbnails you can see on the flashlevel.com homepage, and when each thumbnail is clicked a larger jpg appears on the same page. I would also like to be able to scroll up and down in a similar way to flashlevel.com
What is the web term for this thumbnail list? And can anyone point me in the right direction for a tutorial on how to create one myself? The only help I can find is for slideshows which is not what I am looking for, so even the correct technical term for this would help me to search for tutorials myself. Thankyou in advance...
Thumbnail
Hi,
Can someone help me/guide me:
I have thumbnail picture and large picture.
When someone clicks on the thumbnail I would like to open the large picture in front of everything on the page.
What code do I use?
Any examples that I can see?
Thank you.
XML Thumbnail Help?
I've through many threads and tried many solutions, but I still can't find 1 that can solve my problem. Well may be there's some useful 1 but I guess my brains can't function well and change the code accordingly...
I wanted to load in a thumbnail into a movieclip and duplicate the movieclip accordingly to the amount of the xml images. I also wanted to seperate the images in XML into categories. How should I write the code?
This is currently what I have for the duplicating MC.
Code:
for (var i:uint=0; i < 50; i++) {
//cube = new Cube(MaterialList applied to object, width, depth, height, wSegments, dSegments, hSegments);
cube=new Cube(materialsList,40,5,42,3,3,3);
p.addChild(cube);
cube.x=Math.random() * 980 - 480;
cube.y=Math.random() * 730 - 350;
cube.z = -70;
cube.rotationZ=Math.random() * 360;
}
well I'm actually trying to load the images into a cube created with Papervision3D. I'm still new both in AS3 and PVD, but I guess the coding it uses should more or less the same.
Thumbnail?
What up everyone
I had made a gallery with 10 thumbnails. When the TN is clicked I would like the image to open in a new window. I C/P this script from the pop up window tutorial
on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "http://www.paint.html";
target_winName = "paint";
width = 600;
height = 300;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}
Then I placed this script in a layer above
_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL("javascript:window.open('"+url+"','"+winNam e+"','"+"width="+w+",height="+h+",toolbar="+toolba r+",location="+location+",directories="+directorie s+",status="+status+",menubar="+menubar+",scrollba rs="+scrollbars+",resizable="+resizable+",top='+(( screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"');void(0);");
};
The problem is it only works for one TN
Can any help me with this one
Help With Thumbnail
Right, i've created a thumbnail that fades from a picture to the name of the gallery its linked to and then back again..looped.
How do i make it into a button that when hovered over changes shape (square morphs into a rectangle) but at any point during its loop.
eg: http://www.visionexpress.co.uk/discover/store.asp
How Can This Thumbnail Done
www.pprturk.com
photography page. I made it with lots of swf files. When I rollover button.
_root.content.loadMovie("1.swf");
opens another swf at content Mc..
THere must be easiest way to do this
thanks
To Thumbnail, Or Not To Thumbnail ?
Yes, I'm making a photo gallery like everyone else. I'm making it so people can order pics from the site. There are going to be about 500 photos per album in 5 different categories. The photos can be shrunk down to about 60kb a piece. If I use the actual pictures as thumbnails, just scaled down, the total size of all the pics will be about 30mb. I know this is a lot.
Either way, the people looking at the album will most likely look at nearly all the pics so they will be using up bandwidth either way. Plus, if I use the actual pics as thumbs the user will not have to wait to see actual pic when it's clicked on because it's already loaded. A preloader is annoying to me. I do realize a preloader would be wise when loading the thumbs. Just dislike them after you click one for the big picture.
So is using shrunken thumbs a necessity or if the big pic is under a certain size it shouldn't matter if I use it for a thumb also?
Thanks for any experience input.
XML Thumbnail Help
my thumbnails are doing this:
X X X X X X X X X X X X
I want them to do this:
X X X
X X X
X X X
X X X
Can anyone help me??
This is my script:
PHP Code:
var nextX = 0
var xmlfilephotos:XML = new XML();
var initThumb:Object = new Object();
xmlfilephotos.onLoad = function() {
for (var i:Number = 0; i<xmlfilephotos.firstChild.childNodes.length; i++) {
initThumb.photo = (xmlfilephotos.firstChild.childNodes[i].attributes.photo);
makeAThumb(i);
nextX += 115;
function makeAThumb(num) {
thumbName = "mcThumb"+num;
mcScroller.attachMovie("thumb", thumbName, num, initThumb);
mcScroller[thumbName].mcPhoto.loadMovie("pictures/thumbs/"+mcScroller[thumbName].photo+".jpg");
mcScroller[thumbName]._x = nextX;
mcScroller[thumbName]._y = 0;
mcScroller[thumbName]._alpha = 80;
}
xmlweddingphotos.ignoreWhite = true;
xmlweddingphotos.load("filephotos.xml");
this.createEmptyMovieClip("mcScroller", this.getNextHighestDepth());
mcScroller._x = -644.5;
mcScroller._y = -50;
Thumbnail?
What up everyone
I had made a gallery with 10 thumbnails. When the TN is clicked I would like the image to open in a new window. I C/P this script from the pop up window tutorial
on (release) {
//customize the window that gets opened
// 0 equals NO.
// 1 equals YES.
address = "http://www.paint.html";
target_winName = "paint";
width = 600;
height = 300;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 1;
resizable = 0;
//sends data back to the function
openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}
Then I placed this script in a layer above
_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
getURL("javascript:window.open('"+url+"','"+winNam e+"','"+"width="+w+",height="+h+",toolbar="+toolba r+",location="+location+",directories="+directorie s+",status="+status+",menubar="+menubar+",scrollba rs="+scrollbars+",resizable="+resizable+",top='+(( screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"');void(0);");
};
The problem is it only works for one TN
Can any help me with this one
Thumbnail
First of all, "Hello everyone!"
Can you tell me how to resize an image.
But don't be so complex.
I know C programming language at upper-intermediate level and read the tutorial that peter hall did write.
First I've build an xml like this
<image>
<image_name>Avatar</image_name>
<image_src>images/avatar.jpg</image_src>
<image_width>74</image_width>
<image_height>90</image_height>
</image>
and I load it using xml connector.
and
I opened a loader and put the image in it by using contentPath.
So, what do I have to do about it.
Please help me!!!
To Thumbnail Or Not To Thumbnail
Hi guys, something thats been bugging me for ages and I've been too afraid to ask... (:wink:)
When I create a flash gallery of some kind I always have it so that there are 2 images for every photo - a thumbnail and a full size version. I've done this in the past because I have control over the thumbnail quality - In the past my experiments with large images scaled down to thumbnail size had a tendency to look pixelated and nasty.
But I was just wondering if techniques have moved forward since the introduction of BitmapData? I don't know very much about the class, but what I do know leads me to believe that I'm probably overcomplicating my life nowadays by having two images. Can anyone shed some light on it?
3 things that are important to me though that you might want to consider -
1. The quality must be good
2. The jpeg will be external
3. The image once loaded needs to be on the screen twice in two different movie clips - once inside the thumbnail button and another inside a large image place holder movieclip.
Xml Thumbnail
Hello, i am presently working on a website, and wondering if anyone knew a site that could help me out or, had any files. Im looking for a xml thumbnail page mabye like small thumbnails on a scrollbar or something that when clicked view the large xml picture
Thumbnail
How do I generate an accurate thumbnail from an flv file?
Array.splice Works But Array.slice Doesnt?
This should be simple enough. I have an array of objects, and I want to SLICE a piece of the array and assign it to a new array. All of my attempts have failed. SPLICE works, and I could duplicate my original array into a temp array and splice out what I want, but surely slice is supposed to save me this trouble, right?
I'm a bit baffled, but here's the code:
Code:
private function createGlist() {
var glistObj:Glist = this;
xml_object = new XML();
xml_object.ignoreWhite = true;
xml_object.onLoad = function(success:Boolean):Void {
if(success) {
var i:Number = 0;
for (var this_node = this.firstChild.firstChild; this_node != null; this_node = this_node.nextSibling) {
glistObj.thumb_array.push(new Gthumb(glistObj, glistObj.thumb_array_mc.getNextHighestDepth(), this.firstChild.childNodes[i]));
i++;
}
var load_start:Number = 2;
var load_count:Number = 2;
glistObj.thumb_load_array = glistObj.thumb_array.slice(load_start,load_count);
trace(glistObj.thumb_load_array); //no result, no error
trace(glistObj.thumb_array.slice(load_start,load_count)); //no result, no error
trace(glistObj.thumb_array.splice(load_start,load_count)); //outputs [object Object],[object Object]
} else {
//error
}
}
xml_object.load(xml_url);
}
Array Copy Points To Original Array Instead Of Duplicating
Hey all.
Spent a long time trying to figure out what was wrong with my code. Then I remembered about arrays being objects instead of primitive variables. My question is, how can I make a duplicate copy of an Array?
Details:
So this code
PHP Code:
package{
import flash.display.*
public class tester extends MovieClip{
var a:Array = [1,2]
public function tester () {
var b = a
trace (a)
b.splice(1,1)
trace (a)
}
}
}
results in this output:
PHP Code:
1,2
1
How can i make b an actual duplicate of a, instead of a pointer?
PHP Code:
b = new Array
b = a
doesn't work either.
Thanks!
DHP
Creating Multi-dimentional Array From Single Array
I have an array
myArray=[hello,bye,fred,1,2,3,4,5,6];
I need to convert it to a multi-dimentional array that would look something like below
array1=[hello,bye,fred];
array2=[1,2,3];
array3=[4,5,6];
newArray=[array1, array2,array3];
I am not sure how to split the array can anyone help? myArray.length/3 would give me the number in each of the new arrays but I am puzzled after this?
Associating Array Elements With Another Array Keeping The Order.
hi, i have already posted this problem yesterday but i haven't solved it yet.
i have two arrays:
array_1[a,b,c,d]
array_2[01,02,03,04]
the first array represents mcs in my stage - the buttons of the menu.
the second represents other mcs, containing some text.
when i rollOver each element of array_1 i would like to show each element of array_2 in the same order and hide it when i rollOver another menu button to show a new one.
I mean, it always has to be showing a with 01, b with 02, c with 03...
any suggestions?
Array Of Movie Loaders/array Of Image Files
Alright. I'm fairly new to Actionscripting, so if we can somewhat lame out the tech talk to mild to medium I'd appreciate it. what I am trying to do is create an swf movie that will interact with a PHP script. first lets start with saying the PHP script reads the directory that it is currently in and filters out any file that is not a GIF,PNG, or JPG and then it suffes all of this into a URL encoded string and the directory path ,such as :
?pictures=image1+image2+image3+image4&path=http://servername/directoryPath
now i have flash load the variables "pictures" and split the images and stuff those into an array and the directory path of course stays in its own seperate variable. ive gotten this far with no problems.
so what im trying to do now with this info is create a bit of a slide show. I want to take the array of pictures and load those into an empty movie clip displaying each picture consecutively. Ive made several attempts but no such luck. Ive tried to use a for() loop to cycle through the array of pictures loading them into the empty clip. im still very new and rather lost with these objects and class use i. Im sure im probably not using a listener of somesort that i need and what not. I am sorry i am probably not giving enough info for all this. the whole idea of this clip is to be able to display an indefinite amount pictures , so the flash player will not know ahead of time how many pictures till the php script has sent all the names of what is in the directory. this movie needs to be able to dynamically load any images that are in that directory.so any suggestions on what i can do with an array an an empty clip? thank you to anyone who can make suggesions.
How Do I Lope Through Array, Delete Clip And Remove From Array
I have a function that creates an instance of a movieClip and adds it to an array.
In my gameloop I loop through the array and change some values. Now I want a cleanup function that loops through the array, and if the y value exceeds a certain value, I want to delete the clip instance and remove the record in the Array.
Could someone please help me with the syntax for that? I will lay the code out below.
Thankyou
Attach Code
var myClipArray = new Array();
public function createClipInstance() {
var myClipInstance:myClip = new myClip();
myClipInstance.y = 0;
addChild( myClipInstance );
myClipArray.push(myClipInstance);
}
// loop through array and check y value
// if y > 400: Delete clip and remove from array
public function cleanClips() {
for (var n:int = 0; n<myClipArray.length; n++){
if (myClipArray[n].y > 400) {
// DELETE CLIP AND REMOVE FROM ARRAY
trace("this is where I need help");
}
}
}
Generate Random Value From Array 'excluding' The Current Array Value
getting my head round flash (sorta!)...
ok, nearly got this working; i have 11 movie clips on the root timeline and a empty controller movie. what i need to happen is for a random movie clip to play. when it reaches a point in it's own timeline, it sets the playNext variable to true and the controller movie clip works out the next random movie to play.
the problem comes when the controller 'randomly' picks the movie clip thats already playing! then the whole thing breaks...
is there a way that i can say 'generate me a random clip to play from this array 'excluding' the currently playing movie clip'?
any suggestions would be grand.
this is what i have on my controller clip:
onClipEvent (load) {
//define a new array
video_array = new Array();
//list each of the videos
video_array[0] = "zero";
video_array[1] = "one";
video_array[2] = "two";
video_array[3] = "three";
video_array[4] = "four";
video_array[5] = "five";
video_array[6] = "six";
video_array[7] = "seven";
video_array[8] = "eight";
video_array[9] = "nine";
video_array[10] = "ten";
//this is the count of how many elements (videos) are in your array
max = video_array.length;
//set the playNext to true
_root.playNext = true;
}
onClipEvent (enterFrame) {
//if playNext is true
if (_root.playNext) {
//generate a new random video to play
randomNumber = Math.floor(Math.random()*max);
//store the name
randomVideo = video_array[randomNumber];
//tell that video to play
_parent[randomVideo].gotoAndPlay(13);
//record the video we are playing
crntVideo = randomVideo;
//set playNext to false
_root.playNext = false;
}
}
Load Xml Images-->Array-->Duplicate Array: AHAA
Hello Kirupians!
[Summary]
I want to load images from an XML, then store the images inside an array, then duplicate that array into other clone arrays so that I can addChild() copies of the images into stage whenever i want (and be able to change their properties).
Basicly i have to create two duplicates; big_img and icon_image
[SYMPTOMS]
Everything is loaded fine;the big_imgloads and positions correctly, but, when i try to load icon_image the first big_img disappears! as if the new array has hasn't duplicated the original array (as if it's only a shortcut, not a real copy).
The cody thing:
ActionScript Code:
// total images read from XMLvar axiLength=Accessoir.length();// main image container arrayvar axxARR:Array = new Array();// add images to arrayfor (var k=0; k<axiLength; k++) { var axxLoader:Loader = new Loader(); axxLoader.load(new URLRequest(Accessoir.PHOTO.text()[k])); axxARR.push(axxLoader); axxLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, axxLoaded);}function axxLoaded(e:Event):void { // show big image if (axiLength==axxARR.length) { axxShow(0); }}function axxShow(ID_AXX:Number) { // duplicate images array var axxImage:Array=axxARR.concat(axxARR); // reposition it axxImage[ID_AXX].x = product_details_swf.axx.x+(axxImage[ID_AXX].width/2)-5.5; // Add init image to accessoires axxImage[ID_AXX].name="axxImage"; product_details_swf.axx.addChild(axxImage[ID_AXX]);}// here i got an event listner to a button, once rolle over is triged it // should make small copies of the whole array images and put them on stage//....function rollover_button(ID_AXX:Number) { for (var i=0; i<axiLength; i++) { axxCreate(i); } function axxCreate(ID_AXX:Number) { var axxPic:Array=axxARR.concat(); imageResizer(axxPic[ID_AXX], 50, 50); axxPic[ID_AXX].name="axxPic_"+ID_AXX; axxPic[ID_AXX].x=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).x+axxPicSpacingX; axxPic[ID_AXX].y=product_details_swf.axx.getChildByName("axxBG_"+ID_AXX).y+axxPicSpacingY; product_details_swf.axx.addChild(axxPic[ID_AXX]); }}
[MORE INFORMATION]
I tried array duplication using; concat and slice but not work, it doesn't creat copies of the orriginal array, but just a shortcut to it!
thanx for any tips!
Generate Random Value From Array 'excluding' The Current Array Value
getting my head round flash (sorta!)...
ok, nearly got this working; i have 11 movie clips on the root timeline and a empty controller movie. what i need to happen is for a random movie clip to play. when it reaches a point in it's own timeline, it sets the playNext variable to true and the controller movie clip works out the next random movie to play.
the problem comes when the controller 'randomly' picks the movie clip thats already playing! then the whole thing breaks...
is there a way that i can say 'generate me a random clip to play from this array 'excluding' the currently playing movie clip'?
any suggestions would be grand.
this is what i have on my controller clip:
onClipEvent (load) {
//define a new array
video_array = new Array();
//list each of the videos
video_array[0] = "zero";
video_array[1] = "one";
video_array[2] = "two";
video_array[3] = "three";
video_array[4] = "four";
video_array[5] = "five";
video_array[6] = "six";
video_array[7] = "seven";
video_array[8] = "eight";
video_array[9] = "nine";
video_array[10] = "ten";
//this is the count of how many elements (videos) are in your array
max = video_array.length;
//set the playNext to true
_root.playNext = true;
}
onClipEvent (enterFrame) {
//if playNext is true
if (_root.playNext) {
//generate a new random video to play
randomNumber = Math.floor(Math.random()*max);
//store the name
randomVideo = video_array[randomNumber];
//tell that video to play
_parent[randomVideo].gotoAndPlay(13);
//record the video we are playing
crntVideo = randomVideo;
//set playNext to false
_root.playNext = false;
}
}
Pan Image With Thumbnail
Hi i have a small fla constructed from one of the tutorials on this site.
It is a zoom and pan image fla
in which a large zoomed image is on the right and a small thumbnail is on the left.
What currently hapenns is that on using the small thumbnail u can navigate the larger image.
What i also want to do is to allow the user to drag the large image also, which i am able to do but the smaller image dosent get updated to show the current zoom area.
i have uploaded the fla here..
http://joediassucks.tripod.com/zoom_flash.zip
regards
rahul
Help With Thumbnail Action
Hi everyone...I have a question for G. Paris about her website. I love the way you made the thumbnails on your portfolio section move when the mouse is over and when its released. Can you tell me how to do that?? I have figured out how to get the first part of the movement, the mouse "over", but I cant figure out how to get the mouse release effect. I would appreciate any help anyone can give...here is the site:
http://www.genevieveparis.com
Thumbnail Gallery
Hi,
I'm following the manual given below here:
http://www.mr10.net/components/gallery/manual/#thesetup
which sets up a thumbnail gallery by calling an xml file.
the gallery is working fine. It's just that i want the bigger images to be clickable and should open in a pop up window. Also i want some description to be added below the bigger images.
Any AS gurus pls help!!!!!
Click A Thumbnail
i am creating a photo gallery as part of my flash movie/web site...
the user scrolls through thumbnail images and i want the user to be able to click on the thumbnail, then it will open in a new flash window the full size image
can anyone tell me how to do this please by providing me with the necessary action script?
thanks alot
Thumbnail With Images.
Ill try to explain what i have in mind.
I'am working on a site for my little baby, so i have a question to all of you flashers..
I want to ad some photo's to the website, the idea will be like this.
When you press the button photo book, you will go to A frame there you will see little windows with images inside, when you press the little window (it's also a button) you will go to another frame where you see the photo bigger with some text on the left side. If you press the back button you will be transported to the frame where all the little images are. I dont want a slide show.
and is there a way to load the images from a server?? I dont know much about action scripts
Please can some one help me I'm stuck on it.
Thank you all.
Thumbnail Fader...?
Hey,
I'm looking for a good tutorial (or movie) for a small "Thumbnail Fader". Like the one at Papa Murphy's website. I've found a couple tutorials that are pretty good but they are only set up for imported jpg's. I was hopeing to find one to load external thumbnails (jpg). Thanks for any pointers. Peace.
MX - Xml Thumbnail Gallery
Hello, I hope someone can spare a little time to help me. I am building a xml photogallery which displays thumbnails which you click on to display a larger pic. The code below displays the the pics for <section name="fashion" id="1"> i need to make a button which when clicked displays the pics for <section name="advertising" id="2">
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<gallery>
<section name="fashion" id="1">
<pictures>
<PICTURE NAME="1" THUMB="tn/tn_fashion_01.jpg" IMAGE="pics/fashion_1_p.jpg" TEXT="test1" />
<PICTURE NAME="2" THUMB="tn/tn_fashion_02.jpg" IMAGE="pics/fashion_2_p.jpg" TEXT="test2" />
<PICTURE NAME="3" THUMB="tn/tn_fashion_03.jpg" IMAGE="pics/fashion_3_p.jpg" TEXT="test3" />
</pictures>
</section>
<section name="advertising" id="2">
<pictures>
<PICTURE NAME="1" THUMB="tn/tn_advertising_01.jpg" IMAGE="pics/advertising_1_p.jpg" TEXT="test1" />
<PICTURE NAME="2" THUMB="tn/tn_advertising_02.jpg" IMAGE="pics/advertising_2_p.jpg" TEXT="test2" />
<PICTURE NAME="3" THUMB="tn/tn_advertising_03.jpg" IMAGE="pics/advertising_3_p.jpg" TEXT="test3" />
</pictures>
</section>
</gallery>
</xml>
and here is the AS
Code:
portfolioInfo = new XML();
portfolioInfo.ignoreWhite = true;
timeline = this;
portfolioInfo.onLoad = function() {
portfolioTag = this.firstChild.firstChild.firstChild.firstChild;
trace(count=portfolioTag.childNodes.length);
for (child=0; child<count; child++) {
currentPicture = portfolioTag.childNodes[child];
currentThumb = menu_mc.createEmptyMovieClip("thumbnail"+child, child);
currentThumb._y = child*75;
image = currentThumb.createEmptyMovieClip("thumbnail_image", 0);
image.loadMovie(currentPicture.attributes.THUMB);
currentThumb.NAME = currentPicture.attributes.NAME;
currentThumb.IMAGE = currentPicture.attributes.IMAGE;
//currentThumb.TEXT = currentPicture.attributes.TEXT;
currentThumb.onRollOver = currentThumb.onDragOver=function () { showName_txt.text = this.NAME;};
currentThumb.onRollOut = currentThumb.onDragOut=function () { showName_txt.text = "";};
currentThumb.onPress = currentThumb.onDragOver=function () { image_mc.loadMovie(this.IMAGE);info_txt.text = "Loading...";};
}
};
portfolioInfo.load("xml_slide.xml");
any help much appreciated
cheers
Scrollable Thumbnail Box
Does anybody know how to make a scrollable thumbnail box for a photo site such as the one in this link? http://www.erikalmas.com/
Thanks in advance!
Randal
|