Advertisement

08.29.2008 at 09:24AM PDT, ID: 23689347
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.9

Adding title to XML Flash gallery and allowing for blank links

Asked by maxms in ActionScript, Macromedia Flash

Tags: , ,

Hello,

I have been trying to add a couple of new features to this XML gallery for a client and can't seem to get it to work.

I need to do three things:

1. Each image can have a link applied to it, however the client wants to allow for images that may not have a link. Right now it will still show the link cursor and then show a 404 error if clicked. I've been trying to figure out how to create an if statement that will just show a system cursor if there is no value for 'thelink.'

2. I am resizing the full images to allow a space underneath them for two lines of text. I need to add the correct code within the ActionScript and the attribute in the XML. Can I add line breaks in the XML or can I set it within the AS to wrap the text?

3. I'm not positive as to how to specify the font face and size. I assume that I would just apply a style to the div that holds the full swf file, correct?

Any help would be appreciated. Please let me know if you have any further questions.

Here is a link to the test page:
http://maxms.com/obu/gallery.htm

I have attached the ActionScript as a snippet. Here is the general XML code:
<gallery thumb_width="33" thumb_height="33" gallery_width="274" gallery_height="328" gallery_x="10" gallery_y="15" full_x="54" full_y="15">
<image thumb_url="753_9845_tn.jpg" full_url="753_9845.jpg" thelink="" />
<image thumb_url="755_1675_tn.jpg" full_url="755_1675.jpg" thelink="" />
<image thumb_url="187_5231_tn.jpg" full_url="187_5231.jpg" thelink="" />
<image thumb_url="753_9670_tn.jpg" full_url="753_9670.jpg" thelink="" />
</gallery>

Thank you so much for your help!!!!!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
var myGalleryXML = new XML();
myGalleryXML.ignoreWhite = true;
myGalleryXML.load("gallery.xml");
 
myGalleryXML.onLoad = function() {
 
_root.gallery_x = myGalleryXML.firstChild.attributes.gallery_x;
_root.gallery_y = myGalleryXML.firstChild.attributes.gallery_y;
_root.gallery_width = myGalleryXML.firstChild.attributes.gallery_width;
_root.gallery_height = myGalleryXML.firstChild.attributes.gallery_height;
 
_root.myImages = myGalleryXML.firstChild.childNodes;
_root.myImagesTotal = myImages.length;
 
_root.thumb_height = myGalleryXML.firstChild.attributes.thumb_height;
_root.thumb_width = myGalleryXML.firstChild.attributes.thumb_width;
 
_root.full_x = myGalleryXML.firstChild.attributes.full_x;
_root.full_y = myGalleryXML.firstChild.attributes.full_y;
 
callThumbs();
createMask();
thumbsOver();
callFullImage(0);
 
};
 
function callThumbs() { _root.createEmptyMovieClip("container_mc",_root.getNextHighestDepth());
        container_mc._x = _root.gallery_x;
        container_mc._y = _root.gallery_y;
        var clipLoader = new MovieClipLoader();
        var preloader = new Object();
        clipLoader.addListener(preloader);
        for (i=0; i<_root.myImagesTotal; i++) {
                thumbURL = myImages[i].attributes.thumb_url;
                /*create myThumb_Container 
                which holds "holder" into which you load the image and
                holds "bordermc" which is the border around your image
                */
                myThumb_Container = container_mc.createEmptyMovieClip(i, container_mc.getNextHighestDepth());
                myThumb_Container._y = _root.thumb_height*i*1.25;
                myThumb_mc = myThumb_Container.createEmptyMovieClip("holder", myThumb_Container.getNextHighestDepth());
                myBorder = myThumb_Container.createEmptyMovieClip("bordermc", myThumb_Container.getNextHighestDepth());
                /// draw the border
                myBorder.lineStyle(1,0x000000,100);
                myBorder.moveTo(0,0);
                myBorder.lineTo(_root.thumb_width,0);
                myBorder.lineTo(_root.thumb_width,_root.thumb_height);
                myBorder.lineTo(0,_root.thumb_height);
                myBorder.lineTo(0,0);
                ////first make all borders visible=false
                myBorder._visible = false;
                clipLoader.loadClip("photos_thumbs/"+thumbURL,myThumb_mc);
                preloader.onLoadComplete = function(target) {
                        target.onRelease = function() {
                                //// this._parent._name since we added the myThumb_Container which holds everything
                                callFullImage(this._parent._name);
                                /// loop through all thumbs and make border visible=false
                                for (i=0; i<_root.myImagesTotal; i++) {
                                        var deselectmc:MovieClip = container_mc[i].bordermc;
                                        deselectmc._visible = false;
                                }
                                /// make the selected border visible=true
                                this._parent.bordermc._visible = true;
                        };
                        target.onRollOver = function() {
                                this._alpha = 40;
                        };
                        target.onRollOut = function() {
                                this._alpha = 100;
                        };
 
                };
        }
}
////Listener for fullImage_mc
var fClip = new Object();
fClip.onLoadInit = function(target_mc:MovieClip) {
        target_mc.onRelease = function() {
                getURL(_root.FullImageLink, "_blank");
        };
 
};
function callFullImage(myNumber) {
        myURL = myImages[myNumber].attributes.full_url;
        _root.createEmptyMovieClip("fullImage_mc",_root.getNextHighestDepth());
        fullImage_mc._x = _root.full_x;
        fullImage_mc._y = _root.full_y;
        ////store the link from XML in _root.FullImageLink
        _root.FullImageLink = myImages[myNumber].attributes.thelink;
        ////////////////////////////////////////////////////
        var fullClipLoader = new MovieClipLoader();
        fullClipLoader.addListener(fClip);
        fullClipLoader.loadClip("photos_full/"+myURL,fullImage_mc);
 
}
 
function createMask() {
 
_root.createEmptyMovieClip("mask_mc",_root.getNextHighestDepth());
 
mask_mc._x = _root.gallery_x;
mask_mc._y = _root.gallery_y;
 
mask_mc.beginFill(0x000000,100);
mask_mc.lineTo(_root.gallery_width,0);
mask_mc.lineTo(_root.gallery_width,_root.gallery_height);
mask_mc.lineTo(0,_root.gallery_height);
mask_mc.lineTo(0,0);
 
container_mc.setMask(mask_mc);
 
}
 
container_mc.onRollOver = thumbsOver;
 
function thumbsOver() {
	this.onEnterFrame = scrollThumbs;
	delete this.onRollOver;
}
 
var b = stroke.getBounds(_root);
 
function scrollThumbs() {
	if (_ymouse<b.yMin || _ymouse>b.yMax || _xmouse<b.xMin || _xmouse>b.xMax) {
		this.onRollOver = thumbsOver;
		delete this.onEnterFrame;
	}
	
	if(container_mc._y >= 10) {
		container_mc._y=10
	}
	
	if(container_mc._y <= -210) {
		container_mc._y=-210
	}
	
	var xdist = _ymouse - 100;
	
	container_mc._y += xdist / -10;
}
[+][-]08.29.2008 at 10:26AM PDT, ID: 22347496

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 10:26AM PDT, ID: 22347497

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 10:48AM PDT, ID: 22347658

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.29.2008 at 12:06PM PDT, ID: 22348335

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: ActionScript, Macromedia Flash
Tags: Adobe, Flash, 8
Sign Up Now!
Solution Provided By: ckoning
Participating Experts: 2
Solution Grade: B
 
 
[+][-]09.03.2008 at 02:00PM PDT, ID: 22381939

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 03:00PM PDT, ID: 22382442

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 03:03PM PDT, ID: 22382463

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.03.2008 at 05:02PM PDT, ID: 22383175

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628