| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Oct 2006
Posts: 8
|
Im currently working on building a revolving image ticker type system with flash. but im having a few issues.
the issue im stumped on is depth swapping in flash. I have a for loop that dynamically creates copies of a movie clip i have in my library based on data pulled from a drupal/amfphp services setup. The clip has 2 text fields, the mx.loader component, and a button. . This being the first time i have worked with depths, im really not sure where to even begin to get this to work right. ideally i want to mouse over one of the instances of the clip and it come to the front. this is my first time working with remoting and depths, so i could be going about this all wrong. here is my code. first frame Code:
import mx.remoting.*;
import mx.rpc.*;
import mx.utils.Delegate;
import mx.remoting.debug.NetDebug;
var gatewayUrl:String = siteRoot + "/services/amfphp";
var imagePath:String = "files/imagecache/flash_image/";
var view:Service = new Service(gatewayUrl, null, "views", null, null);
infoTxt.text = "Loading....";
NetDebug.initialize();
getView('flash_feed','onResultSuccess',['title','path','teaser','field_flash_rotation_image']);
function onResultSuccess(re:ResultEvent){
var oTicker:Object = re.result;
var xpadding:Number = 400/oTicker.length;
var z:Number = 0;
var countDown:Number = oTicker.length;
var counter = countDown;
for (i = 0; i < oTicker.length; i++) {
if (i == 0) {
alphaVal = 100;
} else {
alphaVal = 50;
}
trace("Path:" + oTicker[i].path);
trace("Counter:" + counter);
imageClip = this.attachMovie('imageClip','image' + i, counter, {
_x:0,
_y:0,
_alpha:alphaVal,
xpadding:z,
titleText:oTicker[i].title,
teaserText:oTicker[i].teaser,
path:oTicker[i].path,
imageHolder:siteRoot + imagePath + oTicker[i].field_flash_rotation_image[0].filepath
});
imageClip.onEnterFrame = updateClip;
z=z+xpadding;
counter = countDown-1;
}
}
function getView (viewName:String, handler:String, fields:Array, arg:Array) {
var pc:PendingCall = view.getView (viewName, fields, arg);
pc.responder = new RelayResponder (this, handler, "handleRemotingError");
}
function handleRemotingError (fault:FaultEvent):Void {
NetDebug.trace ({level:"None", message:"Error: " + fault.fault.faultstring});
}
function updateClip() {
this.titleTxt.text = this.titleText;
this.teaserTxt.text = this.teaserText;
this.imageLoader._x = this.xpadding;
this.gotoBtn._x = this.xpadding;
this.imageLoader.contentPath = this.imageHolder;
this.infoLoaded = imageLoader.getBytesLoaded();
this.infoTotal = imageLoader.getBytesTotal();
this.percentage = Math.floor(this.infoLoaded/this.infoTotal*100);
infoTxt.text = percentage+"%";
if (percentage>=100) {
delete this.onEnterFrame;
//infoTxt._visible = false;
}
}
Code:
on(release) {
getURL(path);
}
on(rollOver) {
trace("Rollover start:" + _parent.getDepth());
titleTxt._visible = true;
teaserTxt._visible = true;
trace("Rollover after:" + _parent.getDepth());
}
on(rollOut) {
trace("Rollout start:" + _parent.getDepth());
titleTxt._visible = false;
teaserTxt._visible = false;
trace("Rollout after:" + _parent.getDepth());
}
|
|
|
|
|
|
#2 |
|
MCL -- FTW
|
try this in your rollover code..
this.swapDepths(10000); that will most-likely push that specific clip to the front on rollover..
__________________
Always optimizing...
|
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Oct 2006
Posts: 8
|
nope, this didnt work. the button that has the roll over code is apart of the clip that is being dynamically generated. im not sure if this makes a difference. also worth noting....I tried _parent.swapDepths(10000); as well and the depth for each object originally starts at -16384 and after rolling over the first time it goes to 10000, but all instances stay at that even with roll out code that should be reverting it.
|
|
|
|
|
|
#4 |
|
MCL -- FTW
|
well no two objects can have the same depth .. so you need to make sure your targeting the right movieclip so your swaping the depths right..
if your getting a negative depth .. then your targeting something that was added manually.. your depths for the attached movieclips should be positive.. make if you sent a compressed fla we can see what your doing .. also when you attach code to button instances like you are .. the buttons scope is its parent .. so if you do a trace(this); inside the on(rollover) it should return the name of the parent movieclip that it resides in..
__________________
Always optimizing...
|
|
|
|
|
|
#5 | |
|
Registered User
Join Date: Oct 2006
Posts: 8
|
Quote:
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trouble with dynamic removal of movie clips | mordred58 | ActionScript 2.0 | 3 | 06-01-2006 06:40 PM |
| Text in MC not displayed when put to Dynamic? | SebCH | Simple Stuff (Newbies) | 4 | 01-13-2006 04:34 PM |
| Movie Clips Order | Luigi Vercotti | ActionScript 1.0 (and below) | 2 | 02-27-2004 11:32 AM |
| dynamic fading on duplicated movie clips | stebennettsjb | ActionScript 1.0 (and below) | 19 | 01-05-2004 10:14 PM |
| removing dynamic movie clips | nomaeswonk | ActionScript 2.0 | 3 | 01-03-2004 06:18 PM |