Controling an XML based scrolling thumbnails
hi!
this is my code so far:
import caurina.transitions.*;
var xmlRequest:URLRequest = new URLRequest("scrolling.xml");
var xmlLoader:URLLoader = new URLLoader(xmlRequest);
var imgData:XML;
var imageLoader:Loader;
var rawImage:String;
var rawH:String;
var rawW:String;
var pos:Number;
var imgNum:Number = 0;
xmlLoader.addEventListener(Event.COMPLETE, xmlLoadedF);
Tweener.addTween(Bar_am, {x:-1000, time:10, transition:"linear"});
function xmlLoadedF(event:Event):void{
imgData = new XML(event.target.data);
rawImage = imgData.image[imgNum].imgURL;
rawW = imgData.image[imgNum].imgW
rawH = imgData.image[imgNum].imgH
imageLoader = new Loader;
imageLoader.load(new URLRequest(rawImage));
Bar_am.addChild(imageLoader);
imageLoader.x = stage.stageWidth;
imageLoader.y = (stage.stageHeight - Number(rawH)) / 2;
am trying to make that object to scrol depending on the mouse pos:
ex:
if mouse pose < 50 scrol ight
if mouse pos >500 scrol left
and when am out off the scrolling bar the bar goes to the normal scrolling
thx in advance
PS: tryed many functions not working
hi!
basacly am trying to have a list of pics then every single pic must be clickable and have some effect when the mouse is over it
but am stuck!
should I load everything first?
thx
otherwise, since I must get it done by the end of the I have this code that am trying to change
but don't know how to transform the function responssible for the movement!
plz help
the code:
picData = new XML();
picData.ignoreWhite = true;
picData.onLoad = loadXML;
picData.load("xmlArtData.xml");
function loadXML() {
runScript();
function runScript() {
_root.createEmptyMovieClip("bg", 1);
_root.createEmptyMovieClip("image", 3);
_root.createEmptyMovieClip("thumbnails", 2);
images = new Array();
for (i=0; picData.firstChild.childNodes[i].firstChild.nodeValue != undefined; i++) {
images.push(picData.firstChild.childNodes[i].firstChild.nodeValue);
thumbnails._x = 280;
thumbnails._y = 375;
imageLoading = true;
numObjects = images.length;
objectsInScene = new Array();
focalLength = 800;
spin = 0;
_root.thumbnailSize = 125/((numObjects)/9);
displayPane = function () {
var angle = this.angle+spin;
var x = Math.cos(angle)*this.radius;
var z = Math.sin(angle)*this.radius;
var y = this.y;
var scaleRatio = focalLength/(focalLength+z);
this._x = x*scaleRatio;
this._y = y*scaleRatio;
this._xscale = -(this._yscale=100*scaleRatio);
this._xscale *= Math.sin(angle);
this.swapDepths(Math.round(-z));
angleStep = 2*Math.PI/numObjects;
for (i=0; i<numObjects; i++) {
thumbnail = thumbnails.createEmptyMovieClip("thumbnail_"+i, i);
myPic = thumbnail.createEmptyMovieClip("picHolder", 1);
myPic.loadMovie(images[i]);
thumbnail.angle = angleStep*i;
thumbnail.radius = 250;
thumbnail.x = Math.cos(thumbnail.angle)*thumbnail.radius;
thumbnail.z = Math.sin(thumbnail.angle)*thumbnail.radius;
thumbnail.y = 40;
thumbnail.display = displayPane;
thumbnail.drawBox(_root.thumbnailSize);
thumbnail.buttonize(i);
thumbnail.notLoaded = true;
objectsInScene.push(thumbnail);
panCamera = function () {
spin -= this._xmouse/10000;
for (var i = 0; i<objectsInScene.length; i++) {
objectsInScene[i].display();
thumbnails.onEnterFrame = panCamera;
_root.onEnterFrame = function() {
for (i=0; i<images.length; i++) {
if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail _"+i].picHolder.getBytesTotal() == 1) && _root.thumbnails["thumbnail_"+i].notLoaded) {
if (_root.thumbnails["thumbnail_"+i].picHolder._width>=_root.thumbnails["thumbnail_"+i].picH older._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_" +i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._wid th)));
_root.thumbnails["thumbnail_"+i].picHolder._y = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._height)/2;
if (_root.thumbnails["thumbnail_"+i].picHolder._width<=_root.thumbnails["thumbnail_"+i].picH older._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_" +i].picHolder._height-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._he ight)));
_root.thumbnails["thumbnail_"+i].picHolder._x = (_root.thumbnailSize-_root.thumbnails["thumbnail_"+i].picHolder._width)/2;
if (_root.thumbnails["thumbnail_"+i].picHolder._width == _root.thumbnails["thumbnail_"+i].picHolder._height) {
_root.thumbnails["thumbnail_"+i].picHolder._yscale = _root.thumbnails["thumbnail_"+i].picHolder._xscale=(100*(1-(_root.thumbnails["thumbnail_" +i].picHolder._width-_root.thumbnailSize)/(_root.thumbnails["thumbnail_"+i].picHolder._wid th)));
_root.thumbnails["thumbnail_"+i].picHolder._x = _root.thumbnails["thumbnail_"+i].picHolder._y=0;
_root.thumbnails["thumbnail_"+i].picHolder._alpha = 60;
_root.thumbnails["thumbnail_"+i].notLoaded = false;
if ((_root.thumbnails["thumbnail_"+i].picHolder.getBytesLoaded()/_root.thumbnails["thumbnail _"+i].picHolder.getBytesTotal()<1)) {
if (_root.image.getBytesLoaded()/_root.image.getBytesTotal() == 1) {
if (imageLoading == true) {
_root.image._alpha = 0;
if (_root.image._width>_root.image._height) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._width-400)/_root.image._width));
if (_root.image._height>_root.image._width) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height));
if (_root.image._height == _root.image._width) {
_root.image._yscale = _root.image._xscale=(100*(1-(_root.image._height-400)/_root.image._height));
_root.image._x = (625-_root.image._width)/2;
_root.image._y = (425-_root.image._height);
imageLoading = false;
_root.image._alpha += 5;
if (image._alpha>100) {
image._alpha = 100;
MovieClip.prototype.buttonize = function(num) {
this.onPress = function() {
imageLoading = true;
_root.image.removeMovieClip();
_root.createEmptyMovieClip("image", 3);
_root.image.loadMovie(images[num]);
this.onRollOver = function() {
this.picHolder._alpha = 100;
this.onRollOut = function() {
this.picHolder._alpha = 60;
MovieClip.prototype.drawBox = function(boxSize) {
this.lineStyle(1, 0x000000, 0);
this.beginFill(0x000000, 100);
this.lineTo(boxSize, 0);
this.lineTo(boxSize, boxSize);
this.lineTo(0, boxSize);
this.lineTo(0, 0);
this.endFill();
Similar Messages
-
XML based scrolling thumbnails
IMPORTANT: My first time with flash and actionscript but am a computer science student so code is ok.
that said I wanna build a xml based scrolling thumbnails in an horizontal bar.
each pic should have some effect when the mouse is over it +
the scrolling bar should scrol left or right depending on the mouse pos+
the bar stops when am over a pic (with some conditions)
I think this i all
PS: I have only two days to do it :s
I know it would be better if I do it from scratch this is how I do normaly but here am completly snowed under
plz help thxYour best bet for getting a solution handed to you is to do a Google search for "AS3 scrolling menu tutorial" Since code isn't an issue for you, you should be able to modify whatever you find to suit your detail needs once you understand how it is designed.
-
XML scrolling thumbnail, image loader, & Buttons [halfway works]
Intro:
I started a flash-based website a few years ago. Back in 2006 I was able to get a xml scrolling thumbnail, image loader to work without a glitch.
For numerous reasons I had to put the project on hold until now. [one was that my 30 day trial of flash expired and only recently was I able to purchase the Adobe Web Suite CS4 as well as a new computer which could run the apps.]
Last Friday saw a bump in the road in the development of my site as two, rather straightforward task, turned into something short of a nightmare as I have been unable to get past these two, seemingly, relatively simple task.
I have posted in 4 other flash forums the issues, in detail, that I am facing - and have quite a bit of interest/views in the topic as the numbers suggest - yet no response/answer as of yet. [Which confirms other messages I have seen which seem to state that working with buttons has become increasingly difficult with the newer version of flash - something Im a bit surprised with actually from Adobe. - I would have thought there would be a palette where you could set parameters...]
Screenshot of Site/Timeline:
Before getting into the two questions I have, I would like to post an image of the site as it looks whenever an swf file is saved out, as well as a piece of the timeline in the back for reference.
Issue #1
As of now when the swf file is saved out you get exactly what you see above:
a: A scrolling thumbnail
b: ...which loads a large image when clicked on it - PEFECT...
BUT...
1a: I need for the buttons to load in this action, not for it to just load on its own.
[i.e., the silk_paintings gallery is what is open, so I need the "silk_paintings" button to call up this action]
note: Initially I had attacked this problem by taking out the actions layer you see above and applying it directly to the individual buttons with some crude MouseEvent Listener/Handerls... that did not work - at all.
Im sure it may be "easier" to make an array out of it, but with my coding level it may be "easier" to apply it to the buttons.
1b: How I currently see it, I would take the xml-list and duplicate it for the number of galleries I have.
[I would then re-name the xml-list to reflect the name of the galleries they are to represent, i.e. "silk_paintings"]
[also, I would have to rename the folders to "thumbnails1,2,3, etc., & "images 1,2,3, etc"
From there I would duplicate the actions and paste it into the buttons, changing the xml-list name to that of "silk_paintings", etc., as well as write in the MouseEvent listener Handler to make it work. [ah, ha, but what is that magic phrase, I have tried to implement various code from other tutorials, and all in vein.]
Issue #2
At this point I would be tickled pink just to get this to basic function to work.
However, once the buttons are working and calling up the xml, etc., then I need the buttons to stay on the semi-transparent blue color it is whenever in the 'hit' state. [note: NOT pictured above.]
With the way the buttons are currently set up, and with wanting to use scripting to get them to interact with the thumbnail gallery, it will have to be some miraculous code to tell that button what color to stay as whenever its clicked, and of course it going back to white when another button is clicked.
Conclusion:
Since this is an Adobe Forum I would like to make a few additional statements in hopes that the developers, etc. may take heed.
Adobes products are not cheap, and when I went to purchase the websuite I went in as a designer needing a program as not to need to program.
I understand the flexibility that coding gives, but something as simple as linking buttons should not be in the realms of rocket science. [yes, for many its not...but my brain just does not operate that route despite all the tutorials thrown at me.]
Again, it would seem that there would be a button panel where you could drag options like scrolling thumbnail slider, loader, and then parameters would come up. [much like Apples iWeb. - but before the argument of one being pro and the other for non-pros, I see it differently. Software should not be the limiting factor in how flexible you can design, or rather ones lack of programming shouldnt be. With all the talented, and I say this in all humility and honesty, programmers working for Adobe, Im sure something could be programmed like what Im asking for.]
note: Director is a good example, back in 1997 I knew nothing of multimedia and in one week I had assembled a portfolio, clicking buttons, speech, movies, and all. - and no, I dont have the money to buy more software!
At this moment I am at the mercy of someone who reads code like its a nighttime tale they are telling their kids, and who can see the exact issue I have and can share the appropriate, correct code. [as I have noticed, it has to be on target - naturally - but this target changes with just a slight change in the design.]
Thank you,
peace
Dalen
p.s.
The actionscript: [note: This is only the current working/good code that Im trying to get the buttons to call up.]
stop();
fscommand("allowscale", false);//keep SWF display at 100%
var x:XML = new XML ();//Define XML Object
x.ignoreWhite = true;
var fullURL:Array = new Array;//Array of full size image urls
var thumbURL:Array = new Array;//Array of thumbnail urls
var thumbX:Number = 25;//Initial offset of _x for first thumbnail
x.onLoad = function(){ //Function runs after XML is loaded
var photos:Array = this.firstChild.childNodes;//Defines variable for length of XML file
for (i=0;i<photos.length;i++) {//For loop to step through all entry lines of XML file
fullURL.push(photos[i].attributes.urls);//Each loop, adds URL for full sized image to Array fullURL
thumbURL.push(photos[i].attributes.thumbs);//Each loop, adds URL for thumbnails to Array thumbURL
trace(i+". Full Image = "+fullURL[i]+" Thumb Image = "+thumbURL[i]);
var t = panel.attachMovie("b","b"+i,i);//Each loop, Define local variable 't' as a new instance of 'b' movie clip, given unique instance name of 'b' plus the index number of the For loop
t.img.loadMovie(thumbURL[i]);// Each loop, load thumbnail image from XML data into variable movie clip
t._y = 0;//Set Y coordinate of variable movie clip
t._x = thumbX;//Set X coordinate of variable movie clip based on variable thumbX
t.numb = i;//Set sub-variable 'numb' inside variable t to hold index number
t._alpha = 75;//Set the Alpha value of the variable movie clip to 75% - for onRollOver highlight action
thumbX += 55;//Increment thumbX value so next thumbnail is placed 125 pixels to the right of the one before
t.onRollOver = function () {//define onRollOver event of the variable movie clip
this._alpha = 100;//Set thumbnail alpha to 100% for highlight
t.onRollOut = function () {//define onRollOut event of the variable movie clip
this._alpha = 75;//Reset thumbnail alpha to 75%
t.onPress = function () {//define onPress event of the variable movie clip
this._rotation += 3;//rotates thumbnail 3 degrees to indicate it's been pressed
this._x += 3;//Offset X coordinate by 3 pixels to keep clip centered during rotation
this._y -= 3;//Offset Y coordinate by 3 pixels to keep clip centered during rotation
t.onReleaseOutside = function () {//define onRelease event of the variable movie clip
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during rotation
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during rotation
this._alpha = 75;//Reset thumbnail alpha to 75%
t.onRelease = function () {//define onRelease function to load full sized image
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during
this._alpha = 75;//Reset thumbnail alpha to 75%
holder.loadMovie(fullURL[this.numb]);//Load full sized image into holder clip based on sub-variable t.numb, referenced by 'this'
holder.loadMovie(fullURL[0]);//Initially load first full size image into holder clip
x.load ("silk_paintings.xml");// path to XML file
panel.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
var b = stroke.getBounds(_root);
function scrollPanel() {
if (_xmouse<b.xMin||_xmouse>b.xMax||_ymouse<b.yMin||_ymouse>b.yMax) {
this.onRollOver = panelOver;
delete this.onEnterFrame;
if (panel._x >= 740) {
panel._x = 740;
if(panel._x <= (thumbX-10)) {
panel._x = (thumbX-10)
var xdist = _xmouse - 830;
panel._x += -xdist / 7;
The xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<slideshow>
<photo thumbs="thumbnails/i_brown_fairy.jpg" urls="images/brown_fairy.jpg" />
<photo thumbs="thumbnails/i_blonde_fairy.jpg" urls="images/blonde_fairy.jpg" />
<photo thumbs="thumbnails/i_flower_fairy.jpg" urls="images/flower_fairy.jpg" />
<photo thumbs="thumbnails/i_red_fairy.jpg" urls="images/red-fairy.jpg" />
</slideshow>
Attached is a link to the file I made named "index".
https://rcpt.yousendit.com/706233226/5e7b4fe0973dacf090b5cbae32c47398
I would have liked to have included the following files but was limited due to "you-send-it" not uploading folders. Files not included: [but functioning] : xml list - images [folder] - thumbnails [folder]
Again, Thank you
DalenThe issues with the buttons calling up the scrolling thumbnail panel have been resolved, as well as keeping the buttons in their hit state once clicked, thanks to Rob.
Those that have been following this thread, or stumble upon it in their searches later, may appreciate to see the final solution to this particular issue.
[Hopefully I will be able to update this thread with a url in the future to show the site in operation, which may help somebody with their project in the future if its set up similarly.]
Alas, it would be nice if future versions of flash had a more direct, flexible, user friendly method for creating navigation.
[We may see development beyond the flash ads which everyone seems to loathe... and more creativity with flash in terms of games, web interactivity, & animation.
Below are 2 sets of code:
a] the first is located within the first frame of the first button, and has some extra variables in it that the additional buttons call upon...
b] the second is the code applied to every other button.
stop();
fscommand("allowscale", false);//keep SWF display at 100%
var x:XML = new XML();//Define XML Object
x.ignoreWhite = true;
var fullURL:Array = new Array();//Array of full size image urls
var thumbURL:Array = new Array();//Array of thumbnail urls
// ....... CHANGE
var thumbX:Number;// = 25;//Initial offset of _x for first thumbnail
// make an array of all of the instance names of each button object...
// only do this once
var buttonsList:Array = new Array(shadesOfGrey, silkPaintings);
shadesOfGrey.isLatched = false;
// the rollover function... repeat for each button
shadesOfGrey.onRollOver = shadesOfGrey.onDragOver=function ():Void {
if (!this.isLatched) {
this.gotoAndStop(2);
// the rolloff function... repeat for each button
shadesOfGrey.onRollOut = shadesOfGrey.onDragOut=shadesOfGrey.onReleaseOutside=function ():Void {
if (!this.isLatched) {
this.gotoAndStop(1);
// the mouse press function... repeat for each button
shadesOfGrey.onPress = function():Void {
resetAllButtons();
this.isLatched = true;
this.gotoAndStop(3);
shadesOfGrey.onRelease = function():Void {
x.load("shadesOfGrey.xml");// path to XML file
thumbX = 25;
function resetAllButtons():Void {
for (b in buttonsList) {
buttonsList[b].isLatched = false;
buttonsList[b].gotoAndStop(1);
x.onLoad = function() {//Function runs after XML is loaded
// resets the position of the panel on each new load
panel._x = 740;
// ....... CHANGE removes the existing movieclips from the panel before any new load...
for (c in panel) {
if (typeof (panel[c]) == "movieclip") {
removeMovieClip(panel[c]);
var photos:Array = this.firstChild.childNodes;//Defines variable for length of XML file
for (i=0; i<photos.length; i++) {//For loop to step through all entry lines of XML file
fullURL.push(photos[i].attributes.urls);//Each loop, adds URL for full sized image to Array fullURL
thumbURL.push(photos[i].attributes.thumbs);//Each loop, adds URL for thumbnails to Array thumbURL
//trace(i+". Full Image = "+fullURL[i]+" Thumb Image = "+thumbURL[i]);
var t = panel.attachMovie("b", "b"+i, i);//Each loop, Define local variable 't' as a new instance of 'b' movie clip, given unique instance name of 'b' plus the index number of the For loop
t.img.loadMovie(thumbURL[i]);// Each loop, load thumbnail image from XML data into variable movie clip
t._y = 0;//Set Y coordinate of variable movie clip
t._x = thumbX;//Set X coordinate of variable movie clip based on variable thumbX
t.numb = i;//Set sub-variable 'numb' inside variable t to hold index number
t._alpha = 75;//Set the Alpha value of the variable movie clip to 75% - for onRollOver highlight action
thumbX += 55;//Increment thumbX value so next thumbnail is placed 125 pixels to the right of the one before
t.onRollOver = function() {//define onRollOver event of the variable movie clip
this._alpha = 100;//Set thumbnail alpha to 100% for highlight
t.onRollOut = function() {//define onRollOut event of the variable movie clip
this._alpha = 75;//Reset thumbnail alpha to 75%
t.onPress = function() {//define onPress event of the variable movie clip
this._rotation += 3;//rotates thumbnail 3 degrees to indicate it's been pressed
this._x += 3;//Offset X coordinate by 3 pixels to keep clip centered during rotation
this._y -= 3;//Offset Y coordinate by 3 pixels to keep clip centered during rotation
t.onReleaseOutside = function() {//define onRelease event of the variable movie clip
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during rotation
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during rotation
this._alpha = 75;//Reset thumbnail alpha to 75%
t.onRelease = function() {//define onRelease function to load full sized image
this._rotation -= 3;//rotate thumbnail back 3 degrees
this._x -= 3;//Reset X coordinate by 3 pixels to keep clip centered during
this._y += 3;//Reset Y coordinate by 3 pixels to keep clip centered during
this._alpha = 75;//Reset thumbnail alpha to 75%
holder.loadMovie(fullURL[this.numb]);//Load full sized image into holder clip based on sub-variable t.numb, referenced by 'this'
holder.loadMovie(fullURL[0]);//Initially load first full size image into holder clip
// this one function scrolls the panel for all of the buttons, it gets the
// size of the panel when the images are loaded by any given button...
stroke.onEnterFrame = function() {
if (this.hitTest(_xmouse, _ymouse, false)) {
if (panel._x>=740) {
panel._x = 740;
if (panel._x<=740-panel._width+mask._width) {
panel._x = 740-panel._width+mask._width;
if ((panel._x<=740) && (panel._x>=740-panel._width+mask._width)) {
var xdist = _xmouse-830;
panel._x += -xdist/7;
Of note is the change to how the movie clips are measured... this change in and of itself has really helped to make the thumbnail panels operation more efficient.
Below is the script for each additional button: [Having issues with the forums not letting me post additional code, so I will put the remaining code in a reply below.]
cont. -
Tutorial on creating a scrolling thumbnail menu in AS 3.0
I've found several good tutorials in AS2.0 on creating a scrolling thumbnail menu bar for adding to a photo gallery, but nothing in AS3.0. Anyone have a tutorial or code they'd like to share?
A solution using tilelist component
import fl.controls.TileList;
import fl.controls.listClasses.ImageCell;
import fl.data.DataProvider;
import fl.events.ListEvent;
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
var loader:Loader;
var dp:DataProvider = new DataProvider();
dp.addItem({label:"IMAGE 1",source:"images/image1.jpg"});
dp.addItem({label:"IMAGE 2",source:"images/image2.jpg"});
dp.addItem({label:"IMAGE 3",source:"images/image3.jpg"});
dp.addItem({label:"IMAGE 4",source:"images/image4.jpg"});
dp.addItem({label:"IMAGE 1",source:"images/image1.jpg"});
dp.addItem({label:"IMAGE 2",source:"images/image2.jpg"});
dp.addItem({label:"IMAGE 3",source:"images/image3.jpg"});
dp.addItem({label:"IMAGE 4",source:"images/image4.jpg"});
dp.addItem({label:"IMAGE 1",source:"images/image1.jpg"});
dp.addItem({label:"IMAGE 2",source:"images/image2.jpg"});
dp.addItem({label:"IMAGE 3",source:"images/image3.jpg"});
dp.addItem({label:"IMAGE 4",source:"images/image4.jpg"});
tilewindow.width=500;
tilewindow.height=100;
tilewindow.dataProvider = dp;
tilewindow.rowCount=1;
tilewindow.addEventListener(ListEvent.ITEM_CLICK,loadImage);
function loadImage(event):void{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,oncom);
loader.addEventListener(IOErrorEvent.IO_ERROR,onerr);
loader.load(new URLRequest(event.item.source));
function oncom(event):void{
container.addChild(loader.content);
loader.content.width=500;
loader.content.height=250;
function onerr(event):void{
trace(event);
complete source can be found here http://www.4shared.com/file/zeOd0Dey/tileListcomponent.html -
Pre-loading external images for XML-based gallery
I'm working-on an XML-based photo gallery here:
http://www.unionandparkwood.com/demo/flash_gallery/
It works how I want it, except that the first time a
thumbnail is clicked for an image, it pauses long enough to skip
the fade. If you click-through the images a second time, you'll see
that it works smoothly. My guess is that the first time the
thumbnail is clicked, the image isn't cached, yet.
I tried to fix this by creating a JavaScript file for the
page to pre-load each image and thumbnail:
0003a = new Image;
0003a.src = "images/Down-Range.jpg";
0003b = new Image;
0003b.src = "thumbnails/Down-Range.jpg";
But that didn't work. What would be the best way to do this?
I included a link to "Download ZIP" of the FLA project on
this page, too, because it wouldn't be easy for me to describe
what's happening. In a nutshell, a thumbnail click launches a
function that loads the appropriate image into the main image
holder. What seems to be happening the first time is the image
isn't loaded before the fade is finished, so the image just appears
after a short pause the first time.>>What seems to be happening the first time is the
image isn't loaded before
>>the fade is finished, so the image just appears after
a short pause the
>>first time.
As has been said many times in thos forum - use the
MovieClipLoader class to
load images, and then use that class' onLoadInit method to do
things with
the loaded image. Loading is asynchronous - you _have_ to
wait until the
image is done loading before doing a fade.
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/ -
XML & AS - Aligning Thumbnails In Grid
I'm currently using Flash 8.
So I've got a flyout menu working, and it's showing up
exactly how I want it to. Mouse over the button at the bottom of
the screen, and whammy - the menu slides into place all
smooth-like.
But then comes the problem. I, of course, want the flyout
menu to be visible and active while the mouse is on top of it.
However, when I move the mouse off of the menu, I'd like it to
slide back out of view.
I haven't been able to figure out how to accomplish that just
yet.
Here's my code thus far - maybe someone can help flesh out
the rest of it.
Thanks!
import mx.transitions.Tween;
import mx.transitions.easing.*;
var startY:Number = gallery._y;
gallery_btn.useHandCursor = false;
gallery_btn.onRollOver = function () {
if(gallery._alpha==0){
new Tween(gallery,"_alpha",Regular.easeOut,0,100,12,false);
new
Tween(gallery,"_y",Regular.easeOut,startY,startY-200,12,false);
}Well, of course it won't be that easy!
I've got the flyout menu working.
I put together a nice little scroll panel of thumbnails.
I used this tutorial to help me along with the panel:
http://www.gotoandlearn.com/
I've got ten buttons placed together in a movie clip - the
movie clip is what you scroll through in the panel.
I've got the full-sized images in the library.
However, I can't figure out how to get the buttons to bring
up the image it's linked to. They're active as buttons - when you
hover over them, you get the little hand and everything... test out
the different states for the button to make sure that it was
recognized as a button. They are, but I can't get them to do what I
want.
If I place the same button on the stage without being a part
of the movie clip of scrolling thumbnails, then it works properly.
If I apply the same actionscript to the button in the movie clip,
it does nothing.
Also, there's another issue that I'm having. I don't want to
have to import all of the images and thumbnails into my library. I
really want to build this with XML. I've found a couple of
tutorials that touch on creating an XML gallery in Flash, but I'm
having trouble getting that to work as well. Most of the tutorials
I've found just throw everything at you with a pre-configured .FLA
file and whatnot. I'm very big on learning it myself and building
my own gallery.
I don't know... gah, I'm all over the place right now.
One step at a time, I guess, then I'll rain down more
questions if I have them, heh
Thanks for the great help so far. It's very much
appreciated! -
Better control over the creation of thumbnails
While i have nothing against the current method of generating thumbnails with ADDT, I feel we need better controls as to how our thumbnails are created. By all means, the current option of generating thumbnails on the fly can remain, but I feel we need a tab on the image upload behaviour that allows us the developers to determine how our thumbnails are created.
This will mainly happen during the image upload process. For example, in order to get uniform thumbnails, a developer could decide that he wants to crop his thumbnails to a certain size so that they can look good in a gallery. This i feel will come in pretty handy for those who are using Spry to create a photo gallery. At the moment, the one way you can create thumbnails on upload is to create a custom trigger and enter the required code to be executed after the file has been uploaded.
So this feature will be welcomed i feel by many who are not too happy with the current method of generating thumbnails.I agree.
Well said Emmanuel since the ADDT thumbnails are only created when requested by the display thumbnail server behavior. So some additional flexibility would be welcome. For example, when you do not wish to use the server behavior. Till then, we just have to use a custom trigger and to some ADDT users, thats advanced stuff.
Cheers. -
Using XML-based object structures to represent data in code/at run-time
Hello,
I have quite a "high level" question which has be bothering me for some time, and I haven't found the subject tackled in any books. I believe J2SE/J2EE is not an important divide here.
Lets say I want to develop a J2SE game application with two programs: a "level designer", and a "level viewer", and I want to store the level files in an XML format.
My question, and I use this example only to try and illustrate it, is:
when coding the level designer or viewer, is it reasonable to use an XML-based object hierarchy for representing a level in code/at run-time, i.e. using the standard Java DOM APIs? Or should one (as I would have done before XML came along) develop a set of classes much closer to modelling the real form of a level, and then add a means to convert those objects to/from to XML format?
This second option of course I would use/would have used if I wasn't thinking about XML, but isn't it sometimes easier to just read in an XML file into a DOM representation and just use the data straight out of that structure, rather than go through the bother of parsing the XML into a set of unrelated objects defined by a different family of classes? What shapes your decision here? And if the second option is best, what is the easiest way of converting to/from the XML?
Thank you for any advice.
GregHi Christian,
Can I ask: what about if your domain was quite 'close' to an object/DOM representation of XML?
For instance, what if a game operated by acting out a theatrical script, a spoken conversation, between two characters, perhaps somehow influenced at points by the user, and a particular level was just a different script for the characters.
One could imagine that the object representation of this would in the end be quite similar to how you'd represent XML, i.e. like a tree of nodes, where each node was a line from the script, and some nodes were a decision point where different nodes could be chosen from.
Would you still want to avoid using XML-based classes to represent the underlying 'game', or is there a point where you would 'give it' to the similarity and use existing XML structures directly?
Thank you for any advice
Greg -
How to control the measure based on the related dimension.
Hi Experts,
In order to improve performance, I have created three kinds of time tables in DB,such as Year .Month, Day.
Then import them into the physical layer in RPD, and combine them into one dimension in BMM.
Actually, it has three level fact related with three time tables,so they are also dragged into one fact in BMM,and one column will be corresponding with three column derived from different Fact table in physical layer.
So I want to know how to control the measure based on the related dimension.
For example:
when users drag the Year,Sales column, it will come from Year Dimension and Year Fact Table.
when users drag the Month,Sales column, it will come from Month Dimension and Month Fact Table.
when users drag the Day,Sales column, it will come from Day Dimension and Day Fact Table.Hi,
Create a dimension Hierarchy, with Year >> Month >> Day Levels and
Next Double click on Year Table LTS >> click on Ocntetnt Tab >> set as Year
same way for Month LTS and Day LTS.
So now when you select year column then server canknow which LTS to hit and Hits Year LTS.
Mark If Helpfu/correct
Thanks. -
Xml gallery with thumbnails & next/previous buttons.
hallo all the wise people,
sorry to bother you, but i'm kind of desperate, and nobody around to ask, so....
i've spend now three full days editing an xml gallery... to my needs, and always goes messy, so maybe it's time give up and make my own from the scratch, or looking from a one closer to my needs =/ (helpless).
could anyone help - maybe any of you by some chance knows a link as close as possible to tutorial/source as3 fla to sthg as close as possible to this:
a) xml gallery
b) thumbnails
c) when thumbnail clicked a big picture shows
d) next/previous buttons possible
otherwise, i can also post the code of my gallery where i absolutely can't add next/previous buttons without making a big mess =/
i will be totally youbie doubie grateful for any help... any, if you only know any good link, 'll try to fugure out a tutorial or edit the source myself....
thanks in advanceheyyyo wise one,
at least this is really nice of you to ask - this gallery really makes me by now feel twice as blond as i am 8-0. but this is kinda really nested.
the xml structure goes like this (this is easy and more or, less standard)(Caption is neglectable, probabaly i will not even display it, unless i have some extra time):
<MenuItem>
<picnum>01</picnum>
<thumb>thumbs/Image00001.jpg</thumb>
<picture>Image00001.jpg</picture>
<Caption>Fist Title</Caption>
</MenuItem>
uaaha, then the as goes. there is the URLloader, but also two different loaders inside (one for the thumbnails, one for the big picture). and this is all inside a for each loop -eh... i was always trying to change the pictLdr behavior - the loader, that loads the big picture.
anyway the URL loader, and the main function, which is attached to it go like this:
var myXML:XML = new XML();
var XML_URL:String = "gallery_config.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
myLoader.addEventListener("complete", xmlLoaded);
// Create the xmlLoaded function
function xmlLoaded(event:Event):void
// Place the xml data into the myXML object
myXML = XML(myLoader.data);
// Initialize and give var name to the new external XMLDocument
var xmlDoc:XMLDocument = new XMLDocument();
// Ignore spacing around nodes
xmlDoc.ignoreWhite = true;
// Define a new name for the loaded XML that is the data in myLoader
var menuXML:XML = XML(myLoader.data);
// Parse the XML data into a readable format
xmlDoc.parseXML(menuXML.toXMLString());
// Access the value of the "galleryFolder" node in our external XML file
for each (var galleryFolder:XML in myXML..galleryFolder)
// Access the value of the "pagenum" node in our external XML file
var galleryDir:String = galleryFolder.toString();
//trace (galleryDir);
//trace (galleryFolder);//output taki sam jak powyżej
// inicjuję variable flag, która bedzie trzsymac nazwę klikniętego thumbnail
var flag2:String = null;
// Set the index number of our loop, increments automatically
var i:Number = 0;
// Run the "for each" loop to iterate through all of the menu items listed in the external XML file
for each (var MenuItem:XML in myXML..MenuItem)
// Access the value of the "picnum" node in our external XML file
var picnum:String = MenuItem.picnum.toString();
// Access the value of the "pagetext" node in our external XML file
var Caption:String = MenuItem.Caption.toString();
// Access the value of the "thumb" node in our external XML file
var thumb:String = MenuItem.thumb.toString();
// Access the value of the "pagepicture" node in our external XML file
var picture:String = MenuItem.picture.toString();
// Just some trace I used for testing, tracing helps debug and fix errors
//trace(picnum);
var thumbLdr:Loader = new Loader();
var thumbURLReq:URLRequest = new URLRequest(galleryDir + thumb);
thumbLdr.load(thumbURLReq);
// Create MovieClip holder for each thumb
var thumb_mc = new MovieClip();
thumb_mc.addChild(thumbLdr);
addChildAt(thumb_mc, 1);
// Create the rectangle used for the clickable button we will place over each thumb
var rect:Shape = new Shape;
rect.graphics.beginFill(0xFFFFFF);
rect.graphics.lineStyle(1, 0x999999);
rect.graphics.drawRect(0, 0, 80, 80);
// Create MovieClip holder for each button, and put that rectangle in it,
// make button mode true and set it to invisible
var clip_mc = new MovieClip();
clip_mc.addChild(rect);
addChild(clip_mc);
clip_mc.buttonMode = true;
clip_mc.alpha = .0;
// The following four conditionals create the images where the images will live on stage
// by adjusting math through each row we make sure they are laid out good and not stacked
// all on top of one another, or spread out in one long row, we need 4 rows, so the math follows
if (picnum < "05")
line1xpos = line1xpos + distance; // These lines place row 1 on stage
clip_mc.x = line1xpos;
clip_mc.y = yPlacement;
thumb_mc.x = line1xpos;
thumb_mc.y = yPlacement;
else if (picnum > "04" && picnum < "11")
line2xpos = line2xpos + distance; // These lines place row 2 on stage
clip_mc.x = line2xpos;
clip_mc.y = 86;
thumb_mc.x = line2xpos;
thumb_mc.y = 86;
else if (picnum > "10" && picnum < "14")
line3xpos = line3xpos + distance; // These lines place row 3 on stage
clip_mc.x = line3xpos;
clip_mc.y = 172;
thumb_mc.x = line3xpos;
thumb_mc.y = 172;
else if (picnum > "13" && picnum < "21")
line4xpos = line4xpos + distance; // These lines place row 4 on stage
clip_mc.x = line4xpos;
clip_mc.y = 258;
thumb_mc.x = line4xpos;
thumb_mc.y = 258;
// And now we create the pic loader for the larger images, and load it into "pictLdr"
var pictLdr:Loader = new Loader();
var pictURL:String = picture;
var pictURLReq:URLRequest = new URLRequest(galleryDir + picture);
//var pictURLReq:URLRequest = new URLRequest("gallery/Image00004.jpg");sprawia,ze zawsze wyswitla sie jeden obrazek
pictLdr.load(pictURLReq);
// Access the pic value and ready it for setting up the Click listener, and function
clip_mc.clickToPic = pictLdr;
// Access the text value and ready it for setting up the Click listener, and function
clip_mc.clickToText = Caption;
//var instName:String = flag();
// Add the mouse event listener to the moviClip button for clicking
clip_mc.addEventListener (MouseEvent.CLICK, clipClick);
// Set the function for what happens when that button gets clicked
function clipClick(e:Event):void
// Populate the parent clip named frameSlide with all of the necessary data
MovieClip(parent).frameSlide.gotoAndPlay("show"); // Makes it appear(slide down)
MovieClip(parent).frameSlide.caption_txt.text = e.target.clickToText; // Adds the caption
MovieClip(parent).frameSlide.frame_mc.addChild(e.target.clickToPic); // Adds the big pic
} // This closes the "for each" loop
} // And this closes the xmlLoaded function
and the effect looks like this (it's a sketch, so big pictures are loaded randomly, don;t put too much attention to it): http://bangbangdesign.pl/xmlGallery/gallery29.swf
but i guess it's a terrible stuff to go through all this. i would be totallly satisfied with a likng to a good tutorial to do it from scratch, or just a hint where to start rebuilding this.
+ in any case i send greetinngs to whereever you are =] -
How to use/access XML based DVMs in ODI 11.1.1.5.0
Hi All,
I want to use XML based DVMs in interface on ODI 11.1.1.5.0.
I have tried something like this. However while "Load Data" step, i am facing the error "
-4850 : 3F000 : java.sql.SQLException: invalid schema name: CURRENCYCODE
java.sql.SQLException: invalid schema name: CURRENCYCODE
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.prepareStatement(SnpsXmlConnection.java:1192)
at sun.reflect.GeneratedMethodAccessor314.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
at $Proxy138.prepareStatement(Unknown Source)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:111)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:76)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:67)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1595)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$2.doAction(StartScenRequestProcessor.java:580)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.doProcessStartScenTask(StartScenRequestProcessor.java:513)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$StartScenTask.doExecute(StartScenRequestProcessor.java:1070)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.hsqldb.HsqlException: invalid schema name: CURRENCYCODE
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.SchemaManager.getSchemaHsqlName(Unknown Source)
at org.hsqldb.SchemaManager.getSchemaName(Unknown Source)
at org.hsqldb.Session.getSchemaName(Unknown Source)
at org.hsqldb.SchemaManager.getTable(Unknown Source)
at org.hsqldb.ParserDQL.readTableName(Unknown Source)
at org.hsqldb.ParserDQL.readTableOrSubquery(Unknown Source)
at org.hsqldb.ParserDQL.XreadTableReference(Unknown Source)
at org.hsqldb.ParserDQL.XreadFromClause(Unknown Source)
at org.hsqldb.ParserDQL.XreadTableExpression(Unknown Source)
at org.hsqldb.ParserDQL.XreadQuerySpecification(Unknown Source)
at org.hsqldb.ParserDQL.XreadSimpleTable(Unknown Source)
at org.hsqldb.ParserDQL.XreadQueryPrimary(Unknown Source)
at org.hsqldb.ParserDQL.XreadQueryTerm(Unknown Source)
at org.hsqldb.ParserDQL.XreadQueryExpressionBody(Unknown Source)
at org.hsqldb.ParserDQL.XreadQueryExpression(Unknown Source)
at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 27 more"
Steps followed:
1. Created data server with below values.
JDBS Driver : com.sunopsis.jdbc.driver.xml.SnpsXmlDriver
JDBC URL : jdbc:snps:xml?f=/appl/oracle/dev/fmw/11g/product/Oracle_ODI1/oracledi/xml_odi/CURRENCY95CODE.xml&s=CURRENCYCODE&case_sens=true
2. Created a physical schemas out of it and passed SCHEMA as "CURRENCYCODE". Please note that it dint showup automatically. I had to type the schema name "CURRENCYCODE".
3. Implemented logic in interface and facing the above error when tried executing interface at "Load Data" step.
Note : Test Connection is working fine. And i have all the permissions to execute.
Kindly suggest the right way if i am doing something wrong.Hello,
Your filemaker install should have come with a jdbc driver (.jar file). You'll need to check your filemaker pro documentation to confirm. Once you have the file, place it in the ODI/oracledi/agent/drivers folder where your agent lives (also place it on your client if you want to use the local agent for testing). You can then create a custom Technology in the Topology tab in ODI.
There are many options in the Technology definition which you will need to figure out based on what filemaker pro can handle and how it processes queries. Once the technology is created, add a Data Server and Physical Schema as you would any other technology. Then, build the model, datastores, interfaces, etc. just like any other tech.
Hope this gets you started.
Thank you,
Michael R. -
Dynamic element binding between XML based PDF form and WDA context
Hi Experts,
I am working on a XML based interactive form.There is a table node in the XML interface which generated by WDA context, and binding on a subform in the PDF form.
I tried to add instances to the subform using javascript. Unfortunately, I can not get the internal table in WDA.
If I initialize the table to 10 lines in WDA , and then add 5 line to it in PDF, when I submit the PDF, I can only get 10 lines in the WDA framework. It seems that the element which is create dynamically can not be past to the interface.
Could you tell me why? And is there any other better solution? I just want build a table in PDF form in runtime and pass it to WDA context.
Thanks a lot!
Best Regards,
Guo Guo QingHi Thomas,
Thank you for your reply.
I think the performance will be a problem if I create the elment in WDA using submit event. I need to create hundreds of record dynamically. I must find some way to reduce the communication between the WDA and PDF form. Maybe I can set a container with a number of elements before the PDF output. Do you have some better ideas?
Best Regards,
Guo Guo Qing -
Hello:
Does anyone know how I can create scrolling thumbnail images that then link to an enlarged version of the image...without using frames?
take a look at this link:
http://www.carmencicero.com/image_display.php?category=figurative_exp
Can someone point me in the right direction on how to do this?
Thanks
VincentHave a look at AutoScroll at http://www.actionscafe.com/Features_Folder/AutoScroll/asfeatures.html. It's commercial software but it will do the job for you. Run the Quicktime MPEG-4 demos to see it in action.
-
FLV xml-based Captioning (Subtitles)
Hi everyone!
I am following a tutorial from actionscript.org about
creating xml-based subtitles in flash through actionscript.
Although I have followed the instructions and explanations closely,
I can't seem to make the thing work. Take note, there are no error
notifications when I test the movie - I have all the classes
required as well as a sample FLV. Can someone please point out
what's wrong with this script?
This is basically the cached link of the tutorial I followed.
Actionscript.org appears to be inaccessible at the moment.
FLV
Xml-based Captioningbump thread...
-
How do I get my phone out of voice control and can not scroll or use it
How do I get my phone out of voice control and can not scroll or use it?
press the home button and hold it for a few seconds. Voice conrol will appear
Maybe you are looking for
-
How to create a condition in sap
Hi all, How to create a condition in sap i want to create a condition in sap quotation. how to solve this issue please give me idea step by step. [http://www.4shared.com/document/MQiBd3bP/screenshot.html] Thanks & Regards Ambrish Edited by: ambrish d
-
hello This is sudhakar working as a programmer on Java now we are implementing audio recording and playing.. but here we are facing one problem.. that is . how to get the audio frequency...that is pitch but it variate the pitch which during the play.
-
Ran Code: Changed Priviledges, Services, System Files, HD etc.
I just wanted to print my login screen in Single User Mode, used codes I didn't write down (from off the internet, no less) and I cannot remember ls | lpr and/or #/bin/sh gnome - terminal echo -n "new terminal" please someone help me, i did somethin
-
OSB dashboard Service Health tab broken when a managed server is down
I have shut down one of the managed servers in my three-member OSB 10.3.1 cluster to load test the reduced configuration, and that has broken the "service health" tab on the OSB console dashboard. The problem is that with the mgd1 server shut down (t
-
Oracle ADF - Check box auto refresh on first select.
Hi, I am using ADF application for development. in my project. when select Check box for all record selection then all Check box auto refresh on first select. and also records get refreshed Pls suggest a solution for the same. Thanks Vinod