Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-05-2001, 02:15 AM   #1
SiFxBboy
Registered User
 
Join Date: Sep 2001
Posts: 2
Question

hey in Tutorial 17 ( http://www.actionscripts.org/tutoria...ct/index.shtml )it shows how to scroll text and it says that it works better with scrolling images. i need to scroll images but i dunno how to insert images in there instead of text. could someone please teach me how?
SiFxBboy is offline   Reply With Quote
Old 09-05-2001, 09:07 PM   #2
mpol777
Registered User
 
mpol777's Avatar
 
Join Date: Jun 2001
Posts: 247
Default

instead of having a text field in the "contentText" MC just drop in whatever image you want to scroll.
mpol777 is offline   Reply With Quote
Old 09-05-2001, 09:37 PM   #3
SiFxBboy
Registered User
 
Join Date: Sep 2001
Posts: 2
Default

Ok Thx.
SiFxBboy is offline   Reply With Quote
Old 08-20-2009, 09:27 AM   #4
merarajesh
Registered User
 
Join Date: Mar 2009
Posts: 3
Default problem of image scroll through package

hi,
I made image thumbneil through AS file. but i don't know how to add Scroll button to move 4 images each time . images are comming from xml file.

Pls. help me..

My AS Code:-
package
{
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.filters.BitmapFilter;
import flash.filters.DropShadowFilter;
import flash.text.TextFormat;
import flash.text.TextField;
import flash.text.AntiAliasType;
import flash.events.MouseEvent;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import flash.utils.clearInterval;
import flash.utils.setInterval;

public class Main extends MovieClip
{
var xml:XML;
var images:Array;
var imagesLoaded:int=0;
var imagesTitle:Array=new Array();

var zoomed:Boolean=false;
var canClick:Boolean=false;
var lastX:int=10;
var lastY:int=50;
var i:int = 0;
var display_image:int;
var dragging:Boolean=false;
var textformat:TextFormat=new TextFormat();
var screen:Sprite=new Sprite();
var interval:Number;

var field:TextField=new TextField();

var proportion:Number;


public function Main():void
{
screen.graphics.beginFill(0x111111)
screen.graphics.drawRect(0,0,stage.stageWidth,stag e.stageHeight);
screen.graphics.endFill();
loadXML("images.xml");

}


private function loadXML(file:String):void
{
var urlloader:URLLoader=new URLLoader();
var urlrequest:URLRequest=new URLRequest(file);
urlloader.load(urlrequest);
urlloader.addEventListener(Event.COMPLETE,handledX ML);
}


private function handledXML(e:Event):void
{
xml = new XML(e.target.data);
images=new Array();
for (var i:int =0;i< xml.children().length(); i++)
{

var loader:Loader = new Loader();
var req:URLRequest =new URLRequest(String(xml.children()[i].@src));
loader.load(req);
images.push(loader);

imagesTitle.push(xml.children()[i].@title);

}
loader.contentLoaderInfo.addEventListener(Event.CO MPLETE,loaded);


}

private function loaded(e:Event):void
{

for (i=0;i<images.length;i++)
{
//trace(i);
lastX=15;
lastY= 10;
lastY= lastY +60*i;
prepareImages(lastX,lastY,i );

}


}



private function prepareImages(lastX,lastY,i):void
{


var container:Sprite=new Sprite();

var frame:Sprite =new Sprite();
var infoArea:Sprite=new Sprite();
var infoField:TextField=new TextField();
//var button_up:Sprite=new Sprite();
//var button_down:Sprite=new Sprite();

/*
button_up.graphics.beginFill(0x000000)
button_up.graphics.drawRect(40,2,20,20);
button_up.graphics.endFill();
button_up.buttonMode=true;
addChild(button_up);


button_down.graphics.beginFill(0x000000);
button_down.graphics.drawRect(40,380,20,20);
button_down.graphics.endFill();
button_down.buttonMode=true;
addChild(button_down);
*/
/*var mask = new Sprite();
mask.graphics.beginFill(0x0000FF);
mask.graphics.drawRect(0,0,field.width,field.heigh t);
mask.x = field.x;
mask.y = field.y;

field.parent.addChild(mask);
field.mask = mask;

var scrollbar = new Sprite();
scrollbar.mouseChildren = false;
scrollbar.buttonMode = true;
field.parent.addChild(scrollbar);

var icon = new Sprite();
scrollbar.addChild(icon);


*/

//masking


var mask_mc:Sprite=new Sprite();

mask_mc.x=container.x;


mask_mc.y=container.y;


mask_mc.graphics.beginFill(0x000000,100);



mask_mc.graphics.lineTo(container.width,container. height);



mask_mc.graphics.lineTo(0,container.height);
mask_mc.graphics.lineTo(0,0);
container.mask=mask_mc;

trace(container);

//scrolling


// container.y=0;
container.y += Math.cos(((mask_mc.mouseY)/(mask_mc.height))* Math.PI)*15;
// container.y +=lastY;

trace(container.y)

if (container.y > mask_mc.y)
{
container.y = mask_mc.y;

}
//trace(container.y);

if (container.y <(mask_mc.y -(container.height-mask_mc.height)))
{
container.y = mask_mc.y-(container.height-mask_mc.height);


}

trace(container.y);


//Frame
frame.graphics.beginFill(0xFFFFFF);
frame.graphics.drawRect(-20,-20,images[i].width+50, images[i].height+60);
frame.graphics.endFill();


//Background

infoArea.graphics.beginFill(0x111111,0.75);
infoArea.graphics.drawRect(0,0,images[i].width,60);
infoArea.graphics.endFill();
infoArea.y=images[i].height - 60;

infoField.defaultTextFormat = textformat;
infoField.embedFonts = true;
infoField.antiAliasType = AntiAliasType.ADVANCED;
infoField.width = images[i].width - 5;
infoField.height = 70;

//infoField.text = imagesTitle[i];


//REsizing the images

container.scaleX=0.3;
container.scaleY=0.3;


//Position

//container.x=stage.stageWidth/4 + Math.floor(Math.random()* (stage.stageWidth/4));
//container.y=stage.stageHeight/5+Math.floor(Math.random()* (stage.stageWidth/5));
container.x=lastX;
container.y=lastY;

//show filter

var shadowFilter:BitmapFilter = new DropShadowFilter(3, 90, 0x252525, 1, 2, 2, 1, 15);
var filterArray:Array = [shadowFilter];

container.filters = filterArray;

//add on stage

infoArea.addChild(infoField);
container.addChild(frame);

//var display_data:Array=new Array();
//display_data.splice(0,3);
//trace(display_data.splice(0,3));
container.addChild(images[i]);
//trace(images[i]);
infoArea.visible = false;
container.addChild(infoArea);

addChild(container);

//Add Listener

/*container.getChildAt(1).addEventListener(MouseEve nt.MOUSE_UP, zoomHandler);
container.getChildAt(0).addEventListener(MouseEven t.MOUSE_DOWN, dragImage);
container.getChildAt(0).addEventListener(MouseEven t.MOUSE_UP, stopDragImage);
container.getChildAt(0).addEventListener(MouseEven t.MOUSE_UP, stopDragImage);

*/

/*button_up.addEventListener(MouseEvent.MOUSE_DOWN, ScrollPress);
button_up.addEventListener(MouseEvent.MOUSE_UP,Scr ollLeave);
button_up.addEventListener(MouseEvent.MOUSE_OUT,Sc rollOut);
button_down.addEventListener(MouseEvent.MOUSE_DOWN ,ScrollPress);
button_down.addEventListener(MouseEvent.MOUSE_UP,S crollLeave);
button_down.addEventListener(MouseEvent.MOUSE_OUT, ScrollOut);


scrollbar.addEventListener(MouseEvent.MOUSE_DOWN,D ownHandler);
*/





//scrollbar
/*scrollbar=new ScrollBar();
scrollbar.x=20;
scrollbar.y=300;*/



//Scrolling
/*
function DownHandler(e:MouseEvent):void
{
interval=setInterval(scroll,25);
stage.addEventListener(MouseEvent.MOUSE_UP,UPHandl er);

}

function UPHandler(e:MouseEvent):void
{
clearInterval(interval);
stage.addEventListener(MouseEvent.MOUSE_UP,UPHandl er);
}



function scroll():void
{
var move:Number = scrollbar.mouseY;
if(move < icon.height/2)
{
icon.y = 0;
field.y = mask.y;
}
else if (move > scrollbar.height - icon.height/2)
{
icon.y = scrollbar.height-icon.height;
field.y = mask.y + mask.height - field.height;

}
else
{
icon.y = move - icon.height/2;
field.y = mask.y + mask.height/2 - move/proportion;


}
}
*/

/*
function ScrollPress(e:MouseEvent):void
{

//container.scrollV -=1;
//container.scroll=container.scroll-1

}

function ScrollLeave(e:MouseEvent):void
{
//container.scrollV +=1;
}


function ScrollOut():void
{
}
*/







//Drag Function
/*
function dragImage(e:MouseEvent):void
{
e.target.parent.startDrag();
}

function stopDragImage(e:MouseEvent):void
{
e.target.parent.stopDrag();
}
*/



//Zoom

/*function zoomInFinished(e:TweenEvent):void
{
zoomed = true;
canClick = true;
tween.obj.getChildAt(2).visible = true;
}

function zoomOutFinished(e:TweenEvent):void
{
zoomed = false;
removeChild(screen);

tween.obj.getChildAt(0).addEventListener(MouseEven t.MOUSE_DOWN, dragImage);
}
*/



}



//slider

/*public function get percent():Number
{
return percentage;
}

public function set percent( p:Number ):void
{
percentage = Math.min( 1, Math.max( 0, p ) );
marker.y = percentage * (track.height - marker.height);

dispatchEvent( new SliderEvent( SliderEvent.CHANGE, percentage ) );
}
*/



}

}
merarajesh is offline   Reply With Quote
Old 08-21-2009, 12:26 PM   #5
attunedesigns
Helper monkey
 
attunedesigns's Avatar
 
Join Date: May 2009
Posts: 401
Default

Hello. You might get more attention if you started a new thread. Rather than resurrect one 8 years old.
__________________
· flash & design portfolio · me.addEventListener(Life.Events.PARTY,partyHandler ,false,984);
attunedesigns is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar Table with Images yahk ActionScript 1.0 (and below) 0 02-19-2005 02:46 AM
Dynamic images to the scrollpane Flashchick ActionScript 1.0 (and below) 17 03-29-2004 10:54 AM
scrollbar component getEnabled problem mtw ActionScript 1.0 (and below) 2 05-23-2003 04:18 PM
I don't like to double post... ScrollBar Help Warrior ActionScript 1.0 (and below) 0 04-15-2003 08:14 PM
Professional help please... Weird ScrollBar Warrior ActionScript 1.0 (and below) 1 04-15-2003 03:00 PM


All times are GMT. The time now is 05:03 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.