Controlling Pagination With Arrays
How do I create pages of thumbnails based on a total image count?I'm using a loop to populate an image holder mc, (imageHolder) I create 80 (arbitrary) empty movie clips and push them into a large array. That part works fine.Using the length of the large array (newImages), I loop through the clips in that to shift the larger array into smaller ones, incrementally named (pgArray). Since imagesPerPage is 10, I expected to have 10 arrays that contained the empty mcs, but something has gone wrong. Here's my pagination function: Code: function cullArray():Void { trace("cullArray called"); var allImgCount:Number = newImages.length; for (var k:Number = 0; k < Number(allImgCount / imagesPerPage); k++) { var pgArrayName:String = String("pageArray" + k); var pgArray:Array = []; for (var j:Number = 0; j < imagesPerPage; j++) { var img:Object = newImages.shift(); trace("img name: " + img); pgArray.push(img); } trace("Here are the images on the " + k + "st page" + " (" + String(pgArrayName) + ")"); trace(" " + pgArray); } trace("cullArray ended");} Can someone help me out? I think I'm referencing the strings and the arrays incorrectly. Thanks!I found a solution after a while, but it probably needs cleaning up:http://www.kirupa.com/forum/showthread.php?t=257111
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 03-27-2008, 03:04 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pagination Using Arrays: Can Someone Help?
I've been trying to figure out how to return iterative arrays from a loop for pagination. Can someone please help me accomplish this and clean up my code?
As the code stands below, I need to clean-up the remaining mc's. I plan on doing this by comparing the outputted slice arrays to the main one, and pass any keys not mentioned into to their own iterated array.
I think I'm close, but I can't get over this last hurdle alone. Help would be greatly appreciated!
Thanks
Code:
var totalImg:Array = new Array();
var howManyImgs:Number = 66;
var totImgTally:Number = null;
var count:Number = 0;
var lastCount:Number = null;
var imgPerPage:Number = 8;
for (var i:Number = 0; i < howManyImgs; i++) {
totalImg.push(this.createEmptyMovieClip("imgHolder_" + i, this.getNextHighestDepth()));
}
totImgTally = totalImg.length;
for (var j:Number = 0; j < totImgTally; j++) {
if (count <= 0) {
firstCount = count;
trace("firstCount" + firstCount);
}
count++;
trace("loop" + count);
if ((count % imgPerPage) == 0) {
//trace(totalImg / imgPerPage);
lastCount = count;
firstCount = Number(lastCount - imgPerPage);
trace("lastCount: " + lastCount);
//I'd like to return iterated arrays containing the appropriate mc's, but I don't know how. If
//I put a return statement in, this loop quits, but I don't know why.
var tempLoopArray:Array = totalImg.slice(firstCount, lastCount);
trace("tempLoopArray" + tempLoopArray);
}
// As it stands, I need to clean-up the remaining mc's. I plan on comparing the sliced
//arrays to the main one, and pass the remaining keys to their own iterated array.
}
I was able to find a solution after a few days hacking it up. I'd like to know ways of making this more efficient, though....
http://www.kirupa.com/forum/showthread.php?t=257111
Controlling Arrays From Javascript
--------------------------------------------------------------------------------
Hello I have a Flash proyect, that basically is controlled with variables on the _level0 layer.
With Javascript I make a "controller" to control the move all works perfect, but I got a problem trying to change Arrays values from JavaScript to flash (or dont know how to do it)
Ok put an online example at:
http://www.enventa.ws/example/
on the SWF there just this AS code (and the dynamic fields to show the vars):
---
var month:Array = new Array("January","February","March","April");
monthNum = 1;
---
On the Page (you can see the code)
if you fill the message field it works...
if you select a month from the combo, it works
but if you try to change (fill a month Number with his Name) it does not work.
So how to do it?? (is not important if is made with an other JS function) but I need to "fill/modify" the Flash Array from JS
Regards.
There's an ZIP with the source if you want to download it at:
http://www.enventa.ws/example/example.zip
Thanks
Controlling Photo Slideshow In A Target Window Using Arrays
So I'm pretty sure that this can be done, but I haven't coded actionscript for years.
I'm building a photo galley. I would simply like to use a button that is located on my main time frame to trigger the loading and unloading of images in a target window located on the same time frame. I downloaded some code that looked promising from www.kirupa.com/developer/mx/photogallery.htm, but I don't think the flash 5 fla is truly flash 5 compatible.
I'm not very comfortable with variables and arrays so I haven't had much luck adapting that code to my uses. I even started over from scratch and just tried the flash 5 fla I downloaded, with their images in the proper folder for the code to work, and still nothing. Any suggestions? Anyone know of something similar that is flash 5 compliant?
-n
Pagination
Hi
I am having to load a large amount of variables into flash to be outputted, and instead of scrolling them I want to use pagination.
Does anybody have any ideas on how I could sort, and then group my data into small groups and the allow user to select them as s/he wish's.
Thanks
Pagination With XML
Hi gang. Plese, i have problens with pagination and xml. I triing to some days without sucess. Some one can help me?
My code without pagination.
HTML Code:
var menuXML:XML = new XML();
menuXML.ignoreWhite = true;
menuXML.load("inicio.xml");
//Declarando a função montaMenu
function montaMenu() {
var menuBot:String = "modelos_mc2";
//Colocamos aqui o valor do Linkage do nosso MovieClip
var posX:Number = -150;
//Posição inicial de X
var posY:Number = -135;
//Posição inicial de Y, mais a frente entenderão o porque do -20
//Criamos um for que criará um item no menu para cada valor do XML
for (var i = 0; i<menuXML.childNodes[0].childNodes.length; i++) {
//Criamos 2 variáveis que conterão os valores dos atributos do xml (titulo e url) para que possamos acessar esses valores através dessas variáveis
var titulo:String = (menuXML.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue);
var link:String = (menuXML.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue);
var link2:String = (menuXML.firstChild.childNodes[i].childNodes[2].firstChild.nodeValue);
//
//
//O valor da variável link será o mesmo do atributo url do xml
this.attachMovie(menuBot, titulo, i+10);
//Anexamos o MovieClip "itemMenu" no _root do filme, o novo nome dele será o correspondente a variável titulo, que contém o valor do atributo titulo do xml. o i+10 é o valor de i somado a 10 que será o nível do MovieClip no palco
var item:Object = this[titulo];
//Criamos um novo objeto. os [] tem a mesma função que o eval(), com a diferença que o eval não pode acessar valore do objeto e propriedades. Para saber mais F1 =)
item.tituloItem.text = (titulo);
item.rollover_mc.texto_txt.text = (titulo);
//Definimos o valor do texto tituloItem do item
item._x = posX += (item._height)+2;
//Definimos a posição X de item sendo igual a da variável posX
item._y = posY;
//Definimos a posição Y de item sendo igual a da variável posY = posY +(altura de item)+1
item.link = (link);
item.especificacoes = (especificacoes);
item.dados = (dados);
item.link2 = (link2);
item.zoom = (zoom);
item.zoomdois = (zoomdois);
item.desenho = (desenho);
item.titulo2 = (titulo2);
//if (variavel == undefined) {
//variavel = " ";
//}
//Definimos o valor link ao objeto item
//Ação onRelease do objeto
loadMovie(item.link, (""+item.picture+""));
item.teste_txt.text = item.titulo2;
item.teste2_txt.text = item.dados;
item.onRelease = function() {
};
//Ação onRelease
item.onRelease = function() {
_root.boka.alphaTo(100, 1);
_root.xml_txt.text = (this.link2);
_root.mask1_mc.alphaTo(100, 1);
_root.boka.menuXML2.load(""+_root.xml_txt.text+"");
_root.mask1_btn._visible = true;
_root.mask1_btn.useHandCursor = false;
_root.item_mc.alphaTo(100, 1);
_root.boka._visible = true;
};
//Ação onRollOver
item.onRollOver = function() {
_root.xml_txt.text = (this.link2);
this.rollover_mc.alphaTo(100, 1);
//this.rollover_mc.texto_txt.text = (titulo);
};
//Ação onRollOut
item.onRollOut = function() {
this.rollover_mc.alphaTo(0, 1);
};
}
}
menuXML.onLoad = function(ok) {
if (ok) {
montaMenu();
} else {
trace(orrra);
}
};
tanks.
Pagination
Hey Guys,
Looking for a little guidance.
I have an xml file. it has a title and a description tag with properties (not attributes).
i've loaded the xml file into flash and stored the results in 2 arrays.
titles[] and descs[].
What id like to do is create pagination showing 6 items at a time and u can paginate through the pages to show the next 6 items and so on and so forth.
At the moment i can scroll to the next and previous result with controls ive made.
Could any1 direct me on how i would go about creating a pagination system.
Cheers
Hkl
Pagination With AS3
How do you pagintate with AS3? I'm using a htmlText to display XML info but I cant figure out how to paginate with that object. Any help is greatly appreciated!
.: Pagination :.
Hello,
I´m working on a Flash site for a women´s clothing store. I´ve got everything pretty much figured out, but I´m having trouble with pagination from thumbnails. Anyway...here is what I want to happen. The thumb url is pulled from a XML file. I want AS to read through the XML and load all the thumbs into a 4 col. x 3 lines grid with a certain spacing between them. That gives me 12 thumbs per grid. The Problem is that I have 32 thumbs. So I want to be able to show only 12 thumbs at a time.
Bellow the thumbs I´d like to have dinamically generated links with number of "pages", so that when the user clicks o a number, he or she will see a different set of thumbs.
Example:
1 2 3
Clicking on "1", would show the 12 first thumbs.
Clicking on "2", would show from thumb 13 - 24.
Clicking on "3", would show from thumb 25 - 32.
When the user clicks on a thumb, a larger image is then loaded on large movieclip.
This is what I have done so far:
XML File read [OK]
Thumbs load on a 4x3 grid through a function called loadThumbs() [OK]
Page number links generated automatically using array.length calculation and for loop. [OK]
Each number link takes me ONLY to it´s respective thumbnail set [FAIL]
Previous thumbs are removed when a particular thumbset has less than 12 thumbs [FAIL]
Anyway...it´s a little confusing. Right now..no matter which number link I click, it´ll always give me the next 12 thumbs. And when I get to the last thumbset with only 6 thumbs, The first 6 thumbs are replaced with new ones, but the last 6 are not removed.
Here is my code:
Code:
//init global variables and properties
Stage.scaleMode = "noscale";
import gs.TweenFilterLite;
import gs.TweenLite;
import mx.transitions.*;
import mx.transitions.easing.*;
/****************************************************************************
XML LOADING
****************************************************************************/
//handle loading of external images..
var slide:XML = new XML();
slide.ignoreWhite = true;
var counter:Number = 0;
var largeImageUrl:Array = new Array();
var thumbUrl:Array = new Array();
var captions:Array = new Array();//not used
var p:Number = 0;//tracks position in arrays
var maxThumbs:Number = 12;
k = 0;
j = 0;
var totalImages:Number = 0;
slide.onLoad = function() {
largeImageUrl = [];
thumbUrl = [];
xmlNode = this.firstChild;
colecao_txt.text = xmlNode.attributes.nome;
var images:Array = this.firstChild.childNodes;
totalImages = images.length;
for (i=0; i<images.length; i++) {
thumbUrl[i] = xmlNode.childNodes[i].attributes.thumb;
largeImageUrl[i] = xmlNode.childNodes[i].attributes.largeimg;
}
//load the thumbs
pagination();
loadThumbs();
};
slide.load("xml/colecoes.xml");//load xml
var imageWidth:Number = 0;//default x position of our movieclips relative to containing movieclip
var buffer:Number = 20;//padding between images
var thumbsToShow:Number = 5//
/****************************************************************************
LOAD THUMBNAILS, ADD ACTIONS & PADDING TO THUMBS
****************************************************************************/
//here we load in our thumbnails
function loadThumbs() {
// Define number of clips per line
if (k == 4){
j++;
};
if (k > 3){
k = 0;
};
//remove the movieclip loade listener on each iteration of this function
Clip.removeListener(mclListener);
//attach and associate with a variable a MC to hold each loaded movieClip
var container:MovieClip = this.thumbHolder.attachMovie("mini_mc", "thumbBox"+p, counter, {_x:0+(7*k + k*80), _y:0+(7*j+ j*107)});
k++;
//create a movieclip loader
var Clip:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
target_mc._alpha = 0;//set thumb alpha to be zero
};
//handle loading progress - simple counter here
mclListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//use this if you want to indicate loading of your thumbnails etc...
//loadTxt.captions_txt.text = Math.floor(bytesLoaded/bytesTotal*100)+"%";
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
//here we can access our loaded clips properties!
//here is where we attach functions to our clip so that we can dynamically create rollovers etc.
//make our thumbnails visible again
TweenLite.to(target_mc, 2, {_alpha:100});
//based off image width this places our thumbs next to each other
imageWidth = (imageWidth+target_mc._width)+buffer;
//associate a variable here with our p value, we use this later to load in large images
target_mc.pictureValue = p;
//handle image rollovers these are active only on the thumb image!!! Watch the US spelling!
target_mc.onRollOver = function() {
TweenFilterLite.to(target_mc,.4,{type:"Color", brightness:1.5, ease:None.easeOut});
};
target_mc.onRollOut = function() {
TweenFilterLite.to(target_mc,4,{type:"Color", brightness:1, ease:None.easeOut});
};
//handle a click on a thumbnail
target_mc.onRelease = function() {
//load large images
var tween:Tween = new Tween(largeImage_mc, "_alpha", Regular.easeInOut, 0, 100, 3, true);
mcLoader.loadClip(largeImageUrl[target_mc.pictureValue],largeImage_mc);
};
p++; //increment value to cycle through array
counter++; //increment value to stop at 12 thumbs
if (counter<maxThumbs){
loadThumbs();//create loop
}
else{
}
};
//load in the next thumb
Clip.addListener(mclListener);
Clip.loadClip(thumbUrl[p],container);
}
/****************************************************************************
LOAD LARGE IMAGES MOVIECLIP LOADER FUNCTION
****************************************************************************/
/*generic load object here we handle loading in external images etc
this block of code loads the large images into the bright blue mc
for instance, you could fade in/out big images or make a progress indicator
using this block of script*/
var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadStart = function(target_mc:MovieClip) {
//empty
};
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
//amountLoaded = Math.floor((bytesLoaded/bytesTotal)*100);//calulate a loading percentage!
};
listener.onLoadInit = function(target:MovieClip):Void {
//empty
};
mcLoader.addListener(listener);
/****************************************************************************
PAGINATION
****************************************************************************/
// NUmber of thumbs per page
function pagination() {
var thumbHolder:MovieClip = this.createEmptyMovieClip("thumbHolder",100);
thumbHolder._x= 500;
thumbHolder._y= 80;
if (totalImages < 12){
target_mc.pictureValue=0;
loadThumbs();
}
else{
var totalPages:Number =totalImages/maxThumbs;
totalPages = Math.round(totalPages);
for(i=0;i<totalPages;i++){
var pageNumber:MovieClip = this.createEmptyMovieClip("pageNumber"+i,this.getNextHighestDepth());
this["pageNumber"+i]._y = 450;
this["pageNumber"+i]._x = 500 + (7*i + i*20);
var numberText:TextField = this["pageNumber"+i].createTextField("number",1,0,0,20,20);
numberText.text=i+1;
this["pageNumber"+i].onRelease=function(){
k=0;
j=0;
counter=0;
target_mc.pictureValue=0;
loadThumbs();
}
}
}
}
Any help with this would VERY MUCH apreciated.
Thanks.
Pagination Incrementation
Gads. I know there's a way to do this. I'm developing a slide show (very similar to powerpoint, actually) and I would really like to have a page counter (X of Y where X is the current page and Y is the total number of pages) on each page that increments and decrements every time the user clicks the next or back buttons. The I have each "page" set up on its own scene with an action on a button click that goes to next scene or previous scene.
I know there has to be a variable set up as a counter but I"m at a loss as to where I need to start this.
Thanks in advance.
<edit> I'm using Flash MX.
Pagination With Actionscript
I have a simple script that attaches movie clips based on the number of items I have in my array. It currently spits out all of items in one long list. How, with actionscript, can I get my long list to paginate. I basically need it setup such that once I change a variable, that will control the number of items i see. Then i can click next or previous buttons to navigate thorugh the rest of my items. Any help with this would be greatly appreciated.
// ================
// code below
// ================
names =[
"Mike", "John", "Bob", "Chris", "Peter", "Steve", "Jason", "Paul", "David", "Brandon", "Walter", "Joe", "Ariel", "Teresa", "Nancy", "Jane", "Brian", "Patrick", "Mark", "Peter", "Michelle", "Michael", "Richard", "Jennifer", "Jane", "Doug", "Jack", "Allan", "Nancy", "Nick", "Dylan", "Sean", "Julie", "Jackie", "Lisa", "Donna", "Vince", "Ronald", "Josh", "Don"];
nameCount = names.length;
for(var i = 0; i < nameCount; i++) {
var oInit:Object = new Object();
oInit._x = 0;
oInit._y = i * 20;
item = listContainer.attachMovie("nameItem", "item" + i, i, oInit);
item.label.text = names[i];
}
Pagination With Actionscript
I have a simple script that attaches movie clips based on the number of items I have in my array. It currently spits out all of items in one long list. How, with actionscript, can I get my long list to paginate. I basically need it setup such that once I change a variable, that will control the number of items i see. Then i can click next or previous buttons to navigate thorugh the rest of my items. Any help with this would be greatly appreciated.
// ================
// code below
// ================
names =[
"Mike", "John", "Bob", "Chris", "Peter", "Steve", "Jason", "Paul", "David", "Brandon", "Walter", "Joe", "Ariel", "Teresa", "Nancy", "Jane", "Brian", "Patrick", "Mark", "Peter", "Michelle", "Michael", "Richard", "Jennifer", "Jane", "Doug", "Jack", "Allan", "Nancy", "Nick", "Dylan", "Sean", "Julie", "Jackie", "Lisa", "Donna", "Vince", "Ronald", "Josh", "Don"];
nameCount = names.length;
for(var i = 0; i < nameCount; i++) {
var oInit:Object = new Object();
oInit._x = 0;
oInit._y = i * 20;
item = listContainer.attachMovie("nameItem", "item" + i, i, oInit);
item.label.text = names[i];
}
Pagination With Actionscript
I have a simple script that attaches movie clips based on the number of items I have in my array. It currently spits out all of items in one long list. How, with actionscript, can I get my long list to paginate. I basically need it setup such that once I change a variable, that will control the number of items i see. Then i can click next or previous buttons to navigate thorugh the rest of my items. Any help with this would be greatly appreciated.
// ================
// code below
// ================
names =[
"Mike", "John", "Bob", "Chris", "Peter", "Steve", "Jason", "Paul", "David", "Brandon", "Walter", "Joe", "Ariel", "Teresa", "Nancy", "Jane", "Brian", "Patrick", "Mark", "Peter", "Michelle", "Michael", "Richard", "Jennifer", "Jane", "Doug", "Jack", "Allan", "Nancy", "Nick", "Dylan", "Sean", "Julie", "Jackie", "Lisa", "Donna", "Vince", "Ronald", "Josh", "Don"];
nameCount = names.length;
for(var i = 0; i < nameCount; i++) {
var oInit:Object = new Object();
oInit._x = 0;
oInit._y = i * 20;
item = listContainer.attachMovie("nameItem", "item" + i, i, oInit);
item.label.text = names[i];
}
Pagination With Flash 8
I wonder if anyone has been able to load external content (preferably XML) with this pagination technique:
http://ultrashock.com/tutorials/flash8/pagination.php
[AS] Flash Pagination
Hello guys, long time no see,
I have a small problem i must make a flash gallery that supports pagination, i searched in kirupa's forum, found some threads, but i didn't found the answer for my problem.
I have a xml that contains 30 pictures, i parse (read) in flash and i attach some mcs that loads those pictures. I split the pictures in 5 pages, 1 | 2 | 3 | 4 | 5 |. Until know no problems but when i press 2 the mcs 7 - 12 are shown after the 1 - 6 mcs. What i want is that the mcs 7 - 12...to appear in the same place as the mcs 1 - 6.
I have this code:
ActionScript Code:
public function xmlLoad(displayPage:Number) { this.nodes = this.xml.firstChild.childNodes; this.total = this.nodes.length; this.numPage = Math.floor (total / perPage); this.displayMax = Math.min ((displayPage + 1) * this.perPage, total); var init:Number = displayPage * this.perPage; for(var k:Number = 0; k<this.lastMc; k++) { var mc:MovieClip = _root.thumbHolder_mc["_item" + k]; mc.removeMovieClip (); } for(var i:Number = init; i < this.displayMax; i++) { this.firstMC = displayPage * this.perPage; this._thumb = this.attachMovie("_item","_item"+i,i); this._thumb._x = Math.floor(i / 3) * (this._thumb._width + this.spacer); this._thumb._y = Math.floor(i % 3) * (this._thumb._height + this.spacer); this._thumb._title._title.text = this.nodes[i].attributes.title; this._thumb._thumb.loadMovie(this.nodes[i].attributes.thumbSLink); this._thumb.id = i; this._thumb.onRelease = Delegate.createExtendedDelegate(this._thumb,this.Release,[this._thumb.id]); _root.description_mc._description = this.nodes[0].attributes.description; } this.lastMc = this.displayMax; }
*** The script is done in class, but any advice are welcome how to resolve this problem!
Initial i call xmlLoad(0) and when i press the second button i call xmlLoad(1) and so on!
I know that the answer is near, but i to blind to see it!
Thank you in advance, btibia out
Text Pagination In AS 3.0
Has anyone attempted to update the great Ultrashock pagination tutorial to AS 3.0?
http://www.ultrashock.com/tutorials/...pagination.php
Pagination Gallery Help
i am trying to get this gallery to work correctly, i have 13 images from an xml file and i have broken it down to 6 images per page which gives me 3 pages (6, 6, 1).
the problem:
it's only looping through the first group of 6 images, 3 times.
1,2,3,4,5,6
1,2,3,4,5,6
1,2,3,4,5,6
it should be like this:
1,2,3,4,5,6
7,8,9,10,11,12
13,
Actionscript
PHP Code:
function pages(plusOrMinus) { _global.currentNews = _global.currentNews+plusOrMinus; toolong = NewsStack1.length-1; if (_global.currentNews<0) { _global.currentNews = 0; } if (_global.currentNews>toolong) { _global.currentNews = toolong; } checkprevnext = function () { if (_global.currentNews>toolong-1) { btnState = new mx.transitions.Tween(nextx, "_alpha", Normal.easeOut, nextx._alpha, 25, 0.2, true); a2._visible = false; } else { var btnState = new mx.transitions.Tween(nextx, "_alpha", Normal.easeOut, nextx._alpha, 100, 0.2, true); a2._visible = true; } if (_global.currentNews<1) { btnState = new mx.transitions.Tween(prevx, "_alpha", Normal.easeOut, prevx._alpha, 25, 0.2, true); a1._visible = false; return; } btnState = new mx.transitions.Tween(prevx, "_alpha", Normal.easeOut, prevx._alpha, 100, 0.2, true); a1._visible = true; }; /* MOVES DATA NEXT & PREV */ pagex.txtx.text = [_global.currentNews+1]+" of "+[toolong+1]; txtx.txtx.htmlText = _global.NewsStack1[_global.currentNews]; txtx.txtx_2.htmlText = _global.NewsStack2[_global.currentNews]; trace("item: "+_global.NewsStack1[_global.currentNews]); //_parent.pic1x.picx.loadMovie(_global.NewsStack3[_global.currentNews]);}stop();txtx._alpha = 0;pagex._alpha = 0;_parent.contentArea._y = 160;var yTween = new mx.transitions.Tween(_parent.pic1x, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 1.4, true);var newsx = new XML();_global.currentNews = 0;_global.NewsStack1 = new Array();_global.NewsStack2 = new Array();_global.currentNews = "";_global.descStack = {};newsx.ignoreWhite = true;function reloadXML(xmlFile) { var aTween = new mx.transitions.Tween(txtx.imageHolder, "_alpha", mx.transitions.easing.Strong.easeOut, txtx.imageHolder._alpha, 0, .3, true); aTween.onMotionFinished = function() { var aTween = new mx.transitions.Tween(txtx.imageHolder, "_alpha", mx.transitions.easing.Strong.easeOut, txtx.imageHolder._alpha, 100, .3, true); newsx.load(xmlFile); idx = 1; };}if (xmlFile == null) { newsx.load("http://cs.jameslawrie.com/gallery.php?category=panoramic");}newsx.onLoad = function(success) { gotoAndPlay("in"); txtx.heading.htmlText = this.firstChild.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; if (success) { var imgCon = txtx.imageHolder; trace("Pages: "+newsx.firstChild.childNodes.length); for (i=0; i<newsx.firstChild.childNodes.length; ++i) { var xmlItems = this.firstChild.firstChild.childNodes; var perPage = xmlItems.length; trace("Per Page: "+perPage); trace(" "); var n:Number; for (n=0; n<perPage; n++) { if (xmlItems[n].attributes.ID) { trace("ID: "+xmlItems[n].attributes.ID+" - IMGTITLE: "+xmlItems[n].attributes.IMGTITLE+" - IMGTHUMB: "+xmlItems[n].attributes.IMGTHUMB); imgCon.attachMovie("imgItem","imgItem"+i,imgCon.getNextHighestDepth()); imgCon["imgItem"+i]._x = i%3*212; imgCon["imgItem"+i]._y = (i/3)*71; } } _global.NewsStack1[i] = this.firstChild.firstChild.childNodes[i].childNodes[0].firstChild.nodeValue; _global.NewsStack2[i] = this.firstChild.firstChild.childNodes[i].childNodes[1].firstChild.nodeValue; a1.onRelease = function() { a1._visible = false; a2._visible = false; gotoAndPlay("outx"); idx = -1; }; a2.onRelease = function() { a1._visible = false; a2._visible = false; gotoAndPlay("outx"); idx = 1; }; } pages(-1); }};
please help.
FILE HERE: GALTEST FLA
AS3 - Gallery With Pagination
Hi
does anybody know of a good tutorial/s on pagination in AS3?
i`m trying to build a gallery that load its thumbs and big pics from an xml file. my problem is to loop the thumbs on the x and the y, and that if i have more then a number of pics a button will appear and create a new "page" with the rest of the thumbs. i`m learning AS3.
ho and maby another question: what do i need to do inorder to have credits?
best regards
ron
Actionscript Gallery Pagination Help?
I've been unsuccessfully trying to implement pagination in a xml gallery with thumbnails. I use the method on the kirupa site for loading the xml and generating the thumbnails:
Code:
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
thedate = [];
link = [];
linktxt = [];
_global.total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
thedate[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
link[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
linktxt[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
thumbnailer(i);
if (linktxt[i] == undefined) {
linktxt[i] = "";
}
}
} else {
trace("file not loaded!");
}
}
and the thumbnails --
Code:
function thumbnailer(k) {
loaded_counter = 0;
total_thumbs = _global.total;
var page:Number = 1;
var limit:Number = 15;
var row:Number = 0;
var totalPages:Number = Math.ceil(total/limit);
port_mc.pageTxt = "page "+page+" of "+totalPages;
var container = eval("port_mc.t"+k);
trace(k);
var image = container.createEmptyMovieClip("img", "port_mc.t"+k.getNextHighestDepth());
removeMovieClip(container.circle);
//trace (eval(container));
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
if (total>14) {
port_mc.prev_mc._visible = false;
port_mc.next_mc._visible = false;
port_mc.pagenum._visible = false;
}
port_mc.next_mc.onRelease = function() {
}
port_mc.prev_mc.onRelease = function() {
}
target_mc.pictureValue = k;
target_mc.filters = [dropShadow];
target_mc.onRelease = function() {
//p = this.pictureValue;
p = this.pictureValue-1;
nextImage();
//trace(container.img);
container.attachMovie("indicate_mc", "circle", container.getNextHighestDepth());
};
target_mc.onRollOver = function() {
this._alpha = 50;
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k],"port_mc.t"+k+".img");
}
I have a mc with 15 thumbnail holders in which the first 15 images are loaded, then I want to have a prev and next button which will load the next 15 images into the holders. Any step in the right direction will be greatly appreciated. Thanks!
XML Pagination -- Previous / Next Buttons
hey everyone,
i'm trying to seperate some xml data into seperate pages. six entries on each page with three rows and two columns. i got the data to go into two columns...now i'm just trying to set up the next and previous buttons as well as showing only six entries per page.
i looked over online but had no luck. any help would be greatly appreciated!
source and xml file attached.
[CS3, AS2]Minor Pagination Problem
I have combined together a pagination script to work with external xml which rather took me a long time to figure out. Everything work out great except the "total pages" required to make the pages work. The xml passes fine and displays the nodes great, but the next page button wont changes pages unless it knows what the total pages are.
heres my xml modified script:
PHP Code:
var xmlPath:String = "scripts/xml/issues.xml";
//the current page we're on
var page:Number = 1;
//the limit of values we need per page
var limit:Number = 6;
//the current row that we're working on
var row:Number = 0;
//The total pages that we have
var totalPages:Number = Math.ceil(values.length/limit);
//the text at the bottom of the page
var pageTxt:String = 'Page '+page+' out of '+totalPages;
//the function that will add all of the mc's to stage
function createValues():Void{
//this values array will hold all of the values we need to paginate
var nodes = xmlObj.firstChild.childNodes;
values = nodes.length;
//this will always limit the amount to the limit variable
//but, "i" will act as a marker for which part of the values
//array that we're going to use
for(var i = (page-1)*limit; i<page*limit; i++){
//checks if there actually is a value where "i" is
//otherwise we'll get some undefined movieclips
if(i < values){
//attaches the movieclip to the stage
attachMovie('artists_thumb', 'value'+row, i+1);
//sets the coordinates based on the row
this['value'+row]._x = 5;
this['value'+row]._y = 5+this['value'+row]._height*row;
//sets this guys value to the correct part of the array
this['value'+row]._issue.text = "Issue nº "+ nodes[i].childNodes[2].firstChild.nodeValue; //thisValue = values[i];
trace(nodes[i].childNodes[2].firstChild.nodeValue);
//move onto the next row
row ++;
}
}
//then we reset the rows so we can use the variable again
row=0;
}
//we have to remove movieclips from the stage if we're going to paginate
function removeValues():Void{
//its a simple function, hopefully you can understand it
for(i=0;i<limit;i++){
this['value'+i].removeMovieClip();
}
}
//adding functions to the buttons when they're clicked
mcPrev.onRelease = function(){
//if the page isn't too low
if(page > 1){
//then go to the previous page
removeValues();
page --;
createValues();
//updating the text
pageTxt = 'Page '+page+' out of '+totalPages;
}
}
mcNext.onRelease= function(){
//if the page isn't too high
if(page < totalPages){
//then go to the next page
removeValues();
page ++;
createValues();
//updating the text
pageTxt = 'Page '+page+' out of '+totalPages;
}
}
// XML Object
var xmlObj = new XML();
xmlObj.ignoreWhite = true;
xmlObj.onLoad = function(ok) {
if (ok) {
createValues();
trace(values)
} else {
trace("error loading xml");
}
};
xmlObj.load(xmlPath);
where I think the problem lies is the:
PHP Code:
var totalPages:Number = Math.ceil(values.length/limit);
i have tried countless times to modify it and place it else where for flash to get the node.length variable, but with no luck.
your help would be greatly appreciated. thank you.
XML Grid W/ Pagination & Effects
Hi,
I'm looking for help on creating an xml thumbnail grid that allows for pagination with effects or a "transition" when the user clicks next or previous page.
Kind of the same idea as www.badassembly.com 's work area, but using a different effect of course.
What I'm looking for is just some general direction, maybe some tutorial links etc.
I've created numerous xml grids before, but none with pagination. Which I would really like to learn for future reference. And I believe the ability to have transitions from one page to the other like the site I linked would be great.
Any links, code, tips, etc would be greatly appreciated as I can't seem to come up with a good logic on how you would put this together.
Thanks in advance!
Pagination - Dynamic Text Field
Has anyone figured a way to do true pagination in dynamic text fields?
I usualy do page breaks by hand in the content but am working on a project that would benifit greatly from smart pagination.
As far as I know there isn't a way to find out if text overflows a textfield, but I don't know. Anyone have anything on this?
Dynamic Text, Pagination, Resizable
I am trying to create a dynamic text box that pulls data from an external source. I'm using php to pull data from a mysql database. I want the box to be resizable and I accomplished this without any problems. I can pull in the external data without problems. However, my text sizes along with the box. How do I eliminate this? Also, I wish to have no scrollbar and use buttons to page up or down if the text overflows. Is there actionscript to handle pagination?
Many thanks to anyone who can help me with this.
Smart Whole Word Pagination With Strings
Hi all,
I created a SWF file that loads text into a dynamic textbox with a "pagination feature". If the text cannot fit into the textbox, the text will be split up into elements of an array. These elements are then loaded into the textbox whenever the next or previous button are hit.
See example:
http://zenofken.com/textBox.swf (30kb)
Here's the code:
Code:
var textFoo:String = "Save the Planet"; //sample text
var tempHolder:String = ""; //temporary placeholder
var arrayFoo:Array = new Array; //place the contents here
while(textFoo.length > 0) {
tempHolder = textFoo.substr(0,50);
textFoo = textFoo.slice(50);
arrayFoo.push(tempHolder);
}
textBox_txt.text = arrayFoo[0]; //load the first element by default
var fooCounter:Number = 0; //determines which element is being accessed
next_btn.onRelease = function() {
if(fooCounter < (arrayFoo.length-1) ){
fooCounter++;
}
textBox_txt.text = arrayFoo[fooCounter];
}
previous_btn.onRelease = function() {
if(fooCounter > 0){
fooCounter--;
}
textBox_txt.text = arrayFoo[fooCounter];
}
Question: Is it possible to determine cut the text at an exact whole word?
For example: if the phrase "Save the Planet" were to be cut into only 10 characters, we would get "Save the P". Instead of ending at "P", is it possible to end at "the" and have "P" be in the next page as part of the whole world "Planet"?
Pagination/printing Fields - Request To Macromedia
This is a suggestion that I emailed to wish-flash@macromedia.com. I thought others might be interested in it, and may be able to contribute to it.
Send email to the above email address requesting this or other features for Flash 7.
-----
Greetings
Just got back from FlashForward2002, where I was a finalist for my site "zeroEra.com", and wanted to submit my wishlist for printing features in future versions of Flash.
Currently, Flash is excellent for printing off a single page of dynamic content, or numerous pages of static content, but it provides no robust controls for paginated dynamic content.
Most modern online administrative systems, some user systems, and a number of CDROM deployable applications benefit from printable reports or summaries, based on user entries. Currently, implementing such solutions requires developers to build the Flash application, and then create supporting HTML-based pages for printing. This was a minor issue with Flash 5, in that the user had to leave their familiar environment to print. It becomes far more of a concern now with FlashMX, where developers now can create genuine applications, independent of a server back-end, with SharedObjects.
For instance, say I would like to build a CDROM (or even an online) piece, where users can enter variable amount of information (which would be stored with SharedObjects), and then print off a report on that information - this report could be anywhere from one page, through to tens of pages long. Currently, I could not do this in Flash, without having to have the user either: run through the print dialogue once for each page; or print off a bunch of extra blank pages. This is because Flash does not have any support for multiple page print jobs, except via the (VERY) static #P method. Currently, I would have to use a third party tool to write a temporary HTML file to their drive, then use another third party tool to open it, then instruct the user to print it out from their browser - hardly an ideal solution.
I could go on, but I would rather provide some potential solutions for the above mentioned issues.
One excellent solution would be a print queue object. This would allow you to queue up a number of print "objects" for a single print job. For instance:
printJob = new PrintQueue();
printJob.setFooter("myfooterMC",showOnFirstPage,"p ageNumberVariableName");
printJob.setHeader("myHeaderMC",showOnFirstPage,"p ageNumberVariableName");
printJob.addItem("target",arguments);
// carry out some actions that modify target
printJob.addItem("target",arguments);
print(printJob);
arguments would contain bounding box information, etc.
In this fashion, you could generate any number of pages to print, 1 at a time, and then print them all in a single job. You could also specify any parameters that would be universal to the job (for instance, a footer and header).
Another potentially useful capability would be the ability to print a field, and have Flash automatically handle pagination. A rough example would be:
printJob = new PrintQueue();
printJob.setHeader("myHeaderMC",showOnFirstPage,"p ageNumberVariableName");
printJob.addItem("myCoverPageMC",arguments);
printJob.addItem("fieldTarget",boundingBox,paginat e,backgroundColor);
print(printJob);
This would make it very simple to generate simple multi-page reports. Developers could format the text in the field using HTML to create titles, etc. and then add a header to give it a cohesive branded look. Developers could add text fields correlating to "pageNumberVariableName", and it would automatically update the page number in the header/footer.
These are just my early thoughts for this, and are somewhat undeveloped. Please feel free to contact me for clarification or for more information.
Thank you for the great product!
Multi-column Text Layout With Pagination
I'm trying to figure out how to create an AS3 multi-column layout with pagination, much like the functionality on theFWA.com articles. If anyone can give me some direction or offer links to source files, it would be a great help.
I've begun learning AS3 and came across a sample .fla that shows how to create a newspaper style layout with multiple columns. I just need to figure out how to add the pagination feature. The sample I found is here:
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000236.html
Arrays In A Text File To Arrays In Flash
What i am wanting to do is get an array list from an external file and put it into flash arrays, the code i tryed to use was this:
PHP Code:
for (i=1; i<33; i++) {
if(id=="undefined" || id=="NaN"){
} else {
id[i] = id(i)
}
}
But that dosent work obviously.
I know ive got the
PHP Code:
id[i]
bit right, but i dont know how to do the bit from the text file.
in the file it goes like this:
PHP Code:
id1=432&id2=324 ect
So basically what i am trying to ask is how to in a look do variables using the i (id plus the i at the end). Anyone got any ideas?
Sorting Arrays...2-Dimensional Arrays
How would I go about sorting two dimensional arrays using the sort() function. What I'd like to do is organize the arrays inside of an array by a certain variable...
i.e:
array1 = new Array("Name", "State1", "Cost");
array2 = new Array("OtherName", "AnotherState", "OtherCost");
array3 = new Array("DifferentName", "YetAnother", "AndAnother");
allarrays = new Array(array1, array2, array3);
Now, let's say I want to sort the arrays in allarrays by their state variable. In other words, I want to sort them so allarrays would look something like this (if sorted by state):
allarrays:
array2,
array1,
array3
Any suggestions or past experiences with this sort of sorting? Would I use the Sort() fuction? or would I have to make my own sort function? Thanks in advance for any help you can provide.
Arrays: Cleaning Up Empty Arrays
Hi,
So, I have an array generator, and its not worth explaining the details, but long story short, I end up with an array in which some of the slots are "undefined". How can I go through and remove just those slots? Eg this this my Array
myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = undefined
myArray[4] = "pink"
myArray[5] = "undefined
and what I want to end up with is:
myArray[1] = "red"
myArray[2] = "blue"
myArray[3] = "pink"
thx!
-Z
Arrays/Arrays/Arrays/and Functioning.
Can someone please , tell me how to shorten that Rescale function to just do all the movies in one shot ? and also to add an array for the delay which is the ( o.2, 0.4,0.6 ) so i need to shorten all this to do something like this
Code:
rescale = function(){
this.scaleTo(100,2,"easeOutElastic",this.speed);
this.alphaTo(100,2,"linear",this.speed);
}
//... the next line is inserted within the duplicate movie loop
eval("item"+a).speed = 0.2*a
Instead of all this..
Code:
// Callback Function for lacos to tell when to rescale/alpha back to 100 percent
reScale = function(){
//How can I shorten this by just making an array and doing this in One shot ? is the only problem
item0.scaleTo(100,2,"easeoutElastic",0.2);
item0.alphaTo(100,2,"linear",0.2);
item1.scaleTo(100,2,"easeoutElastic",0.4);
item1.alphaTo(100,2,"linear",0.4);
item2.scaleTo(100,2,"easeoutElastic",0.6);
item2.alphaTo(100,2,"linear",0.6);
item3.scaleTo(100,2,"easeoutElastic",0.8);
item3.alphaTo(100,2,"linear",0.8);
item4.scaleTo(100,2,"easeoutElastic",1);
item4.alphaTo(100,2,"linear",1);
item5.scaleTo(100,2,"easeoutElastic",1.2);
item5.alphaTo(100,2,"linear",1.2);
item6.scaleTo(100,2,"easeoutElastic",1.4);
item6.alphaTo(100,2,"linear",1.4);
item7.scaleTo(100,2,"easeoutElastic",1.6);
item7.alphaTo(100,2,"linear",1.6);
item8.scaleTo(100,2,"easeoutElastic",1.8);
item8.alphaTo(100,2,"linear",1.8);
item9.scaleTo(100,2,"easeoutElastic",2);
item9.alphaTo(100,2,"linear",2);
item10.scaleTo(100,2,"easeoutElastic",2.2);
item10.alphaTo(100,2,"linear",2.2);
item11.scaleTo(100,2,"easeoutElastic",2.4);
item11.alphaTo(100,2,"linear",2.4);
item12.scaleTo(100,2,"easeoutElastic",2.6);
item12.alphaTo(100,2,"linear",2.6);
};
//Duplicate method puts all movieclips on stage at 0 alpha so the user doesnt see the placement
for (a=0; a<titles.length; a++) {
duplicateMovieClip("item", "item"+a, a+1);
//eval("item"+a).alphaTo(0,0,null);
eval("item"+a).item_txt.text = titles[a];
eval("item"+a).tween("_x", [posX[a]], 4, "easeoutElastic");
eval("item"+a).tween("_y", [posY[a]], 4, "easeoutElastic", 0.1);
//Callback function is set here
eval("item"+a).scaleTo(0,0.2,"easeoutElastic",0.1,reScale);
item._visible = false;
}
Arrays Referencing Other Arrays?
Picture this... I declare two arrays:
array1= new Array();
array2 = new Array();
Then I went through some data and added values to "array1". For this example, let's say it has 20 values. (length = 20)
I want array2 to be a "backup" of this data, so I did this:
array2 = array1;
I would expect array2 to simply be a copy of the contents of array1. But, whenever I .pop() a value off of array1, array2 ALSO loses that same value! How is this possible? Is array2 only a "reference" to array1??
Only Arrays Or Arrays And Objects
Hi
I've been told not to do this with an array...
PHP Code:
var travelbooks:Array = new Array();
travelbooks.push({titel: "Madrid", release: 2004, pages: 248});
travelbooks.push({titel: "Barcelona", release: 2003, pages: 224});
travelbooks.push({titel: "Tenerife", release: 2002, pages: 124});
travelbooks.push({titel: "Malaga", release: 2005, pages: 172});
for (var i=0; i < travelbooks.length; i++) {
trace(travelbooks[i].release + " - " + travelbooks[i].titel);
}
... but to do this...
PHP Code:
var travelbooks:Array = new Array();
var book_1:Object = {titel: "Madrid", release: 2004, pages: 248};
var book_2:Object = {titel: "Barcelona", release: 2003, pages: 224};
var book_3:Object = {titel: "Tenerife", release: 2002, pages: 124};
var book_4:Object = {titel: "Malaga", release: 2005, pages: 172};
travelbooks.push(book_1, book_2, book_3, book_4);
trace(book_1.titel);
trace(travelbooks);
trace(book_releases);
function book_releases():void {
for (var i:Number = 0; i < travelbooks.length; i++) {
trace(travelbooks[i].release + " - " + travelbooks[i].titel);
}
}
Could you tell me why i'm not supposed to use the first example? And why example 2 doesn't work?
Thank you
Ferran
Creating Arrays From Arrays?
I'm not sure this is possible but...
I'm trying to create a series of arrays from one main array.
My main array [main_elements] contains four items - interactive, motion, print and illustration. This main_elements array is dynamically created from an xml file.
I'm wanting to create a set of arrays based on the content within this initial 'main_elements' array.
So i would end up with an interactive array, motion array , print array and an illustration array.
currently i'm at this stage with it...although i've tried every other combination i can think of to get it working.
ActionScript Code:
for(q=0; q<work_elements; q++){
main_elements[q] = xmlDoc_xml.firstChild.childNodes[1].childNodes[q].nodeName
//this is the actual categories of work - the areas - interactive,motion,print,illustration
var Vname = work_elements_ARRAY[q]
//i need to create an array based on the names in the work elements area
//ie i need an interactive array - motion array etc
Vname = new Array
trace("Vname-- "+interactive.length)
//this trace should pick up the newly created interactive array but it doesn't exsits...???
}//end of second for
I would then fill these arrays with the work items.
As you can guess its a menu system of the simplest kind i'm trying to build.
Is there a better way to be doing this or is it a case of correct syntax / approach??
# Of Arrays - Length Of Arrays
Is a length of 540 to long for an array?
If so what a good limit to cap it at?
What # arrays of max limit are to many for a flash movie?
10?
100?
1000?
I'm just curious as i need to track the _x and _y of a dragable MC for as long as possible - 3 to 4 minutes if i can squeeze that. It needs to have smooth motion when it's played back, so the cord's need to be stored about 3 times a second. I was just wondering if anybody has an idea of how much data is too much?
All comments are welcome. Thx
Arrays In Arrays Trouble
does AS3 have capability to do multidimensional arrays? My computer won't let me download it because I have edu version. 2D arrays would make this a lot easier. Here's the class:
Code:
class com.samainsworth.math.matrix {
var arr:Array;
var r:Number;
var c:Number;
public function matrix(r:Number, c:Number) {
this.arr = new Array(c);
for(var i in this.arr) {
this.arr[i] = new Array(r);
}
this.r = r;
this.c = c;
}
public function getPos(r:Number, c:Number) {
return this.arr[c][r];
}
public function fillPos(val, r:Number, c:Number):Boolean {
if(r <= this.r && c <= this.c) {
this.arr[c][r] = val;
return true;
}
else {
return false;
}
}
}
here's the code in the movie:
Code:
import com.samainsworth.math.matrix;
var m:matrix = new matrix(2, 2);
trace(m.fillPos(1, 0, 0));
m.arr[0][0] = 1;
trace(m.getPos(0, 0));
and last but not least here's error:
Code:
true
undefined
I'm trying to work on 3D which requires a lot of matrices work even though flash doesn't support 3D you can fake it with a lot of math - http://www.kirupa.com/developer/actions ... onCube.swf
Arrays And Pop()
I thought (and the ActionScript dictonary says) that using .pop() with an array will remove a value. How do I use this with gotoAndStop so that in frame 1 I select a random value from my array and goto that frame. Then from each subsequent frame you select from the remaining pool of frames until finally you can play again with a new random set?
Here's my current code in frame 1:
// Declare the function
function getUniqueRandom (number) {
// Create a new array for sequential number list
var numberlist = new array();
// Place each value in sequential array
for (count=1; count<=number; count++) {
numberlist[count] = count;
}
// Create new array for randomised values
this.randomlist = new array();
// Loop from total number of random values down to zero
for (count=numberlist.length-1; count>0; count--) {
// Pick a random number between 1 and the number of random values remaining
picked = math.floor(math.Random()*count)+1;
// Copy the value in that random location in sequential number list...
// ...into the next 'slot' in our random array
this.randomlist[count-1] = numberlist[picked];
// Copy the last remaining value in sequential numbered list...
// ...into the 'slot' used by the number we just picked
numberlist[picked] = numberlist[count];
}
// Send the resulting array back
return randomlist;
}
// Call the function
x = new getUniqueRandom(5);
firstnumber = x.randomlist[0];
secondnumber = x.randomlist[1];
thirdnumber = x.randomlist[2];
fourthnumber = x.randomlist[3];
fifthnumber = x.randomlist[4];
trace (firstnumber);
trace (secondnumber);
trace (thirdnumber);
trace (fourthnumber);
trace (fifthnumber);
ifFrameLoaded (1) {
gotoAndStop ( secondnumber + 1 );
}
Help With Arrays
Can any one out there help me with array I am trying to make a dinamic menu so if you can explain it to me in some thing relating to english it would be very much appreciated
Thanks You
Why Use Arrays?
Okok, I know arrays are useful for listing things and such, but can anyone out there please give me an example of a flash site or a flash site out there that uses arrays in a real world situation?? I don't really understand why we would ever use arrays.
Riki
DIE Arrays DIE
I'm loading a comma delimeted string into a array from a text file.
I use the split function but it but its not actually splitting the string. WTF am I doing wrong?
Text file:
task1="10,20"
Code:
task1ar = new Array(task1.split(","));
Arrays
why this script works:
function check(){
_root.result = new Array()
_root.result[1,1,1] = 1
_root.test = _root.result[1,1,1]
}
but this doesnt:
function check(){
_root.result = new Array()
_root.result[1,1,1] = 1
_root.result[1,2,1] = 2
_root.result[1,3,1] = 3
_root.result[2,2,1] = 4
_root.result[2,3,1] = 5
_root.result[3,1,1] = 6
_root.result[3,3,1] = 7
_root.test = _root.result[1,1,1]
}
Arrays
I want to create an array..that can have values add to it and removed then sends the values in a comma seperated list to server side programme....
for example...there is 20 images on a site...people can add them to an a array list to be sent to them zipped.
at the begining i have:
images = new Array;
on the buttons per image i have:
on release (){
image[0] = 1;
}
on another buttons for image i have:
on release (){
image[1] = 2;
}
Click these and I get a read out of:
1,2
fantastic..but...if I click on image 1 and 3 I get:
1,,3
How do i get rid of the empty arrays I don't want?
that's my question
thank you
Arrays
hi evry one.
can anyone help me with arrays in flash 5?
I want to put in an array the position of a MC in time.
but it doesn't work, i'm sure the syntaxe is not god.
thats what I made if someone could correct it and explain me why it does'nt work would be nice
onClipEvent (enterFrame) {
if (_root.go == 1) {
xpos[_root.compteur] = _root.toto._x;
ypos[_root.compteur] = _root.toto._y;
_root.compteur = Number(_root.compteur)+1;
}
if (_root.go == 2) {
_root.toto._x = xpos.pop();
_root.toto._y = ypos.pop();
}
}
Arrays - Please Help.
Hi there,
I need to find a good tutorial that explains arrays in flash 5. If any one knows of any please could you tell me. I am new to arrays so need to start at the beginning.
If anyone could explain some of the basics on this forum i'd be very appreciative.
Thankyou in advance!
//Gary
Arrays-Your Uses?
Hi all,
This is a totally noob question, but I wanted to ask it here. I'm currently fascinated with the concept of arrays. I understand the concepts behind their use, but I'd love to know what some of you are doing with them. They're not something I've yet gotten into, so-what are some things you folks are doing with them?
Be as verbose as you like-I really wanna know.
Cheers,
Bryan T
Some people used to be lost in the shuffle--------------
now they just shuffle along with the lost.
Help With Arrays -- Help
Hello fellow Flashkit members!!
I need some help working with arrays. I have written up a few functions that deal wirth working with arrays.
The first function takes an array and duplicates a mpovieclip and populates the clips with the text array and an array of links. That part is working...
the second function just adds to the array. working...
the third function is where I am having trouble. I have a variable that shows the array separated by commas and the user can go in and edit out the array and update the array, which updates the whole menu system. My problem is if the array starts off with a length of 4 and I change the elements of the array to 3, then it does not get rid of the 4th menu box. I want it to change from showing four menu items to three menu items. I can't get it to clear out the extra items.
I am reading about arrays, so I'm trying all different projects with working with arrays. I hope Ive made sense in my explanation. If you need to see the .fla, I can post it.
Thanks all,
dduck1934
Arrays With MC
Suppose I'm a very stupiod person (that's not far from true), but suppose it. I need to attach the same movie clip, with different instance names (I know how to 2 do that), but i need to do it in different "positions" of the array. Let's see:
Array ---> myArray
MC ---> myMC
MCs Name ---> myMC0, myMC1....
when the user presses a button, I want to push (Array.push) a MC into the end of the array, when he presses again...the push thing again....oh! and then I want to modify some MC's properties...for example _xscale....
ok...please give me a detailed tutorial on this....coz i've tried so many things....the last thing I remember of arrays is in PASCAL...so try to understand me....
thanx
hide.
MCs In Arrays
Suppose I'm a very stupiod person (that's not far from true), but suppose it. I need to attach the same movie clip, with different instance names (I know how to 2 do that), but i need to do it in different "positions" of the array. Let's see:
Array ---> myArray
MC ---> myMC
MCs Name ---> myMC0, myMC1....
when the user presses a button, I want to push (Array.push) a MC into the end of the array, when he presses again...the push thing again....oh! and then I want to modify some MC's properties...for example _xscale....
ok...please give me a detailed tutorial on this....coz i've tried so many things....the last thing I remember of arrays is in PASCAL...so try to understand me....
thanx
hide.
Arrays With MCs In Them
How do I load the same MC (with attachMovie) into different instances of an array....myArray[0], myArray[1], myArray[2] thay all got to have a MC inside them.....ANd also, how do I change their(the MC) properties.
Please!! pleaseee!!
Thanx
hide.
Arrays?
Would anyone mind briefly explain arrays to me please, and for what reasons they are best used? I’ve read a little about them but it still hasn’t sunk in as I am still very much confused. I think the terminology used was a bit too technical for little ol’ me and there were no examples given either.
Many Thanks
|