Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2001, 06:26 PM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 12
Question movie loads when _y is at a specific position?

I need some advice on the best way to use a function to detect a clip's position while it is moving, and execute a loadMovie to a target when the desired _y position is reached.

I have a function on the timeline and movie clips with onClipEvents on each keyframe (or 'page' in the context of the site) that call this function. The clips pass a variable to the function which is supposed to determine the right content movie to load when the condition is met:

onClipEvent (load) {
category = "home";
_root.moveMe(category);
}

Function moveMe itself looks like this:

function moveme(category) {

currenty = getProperty("_root.presentation", _y);
speed = 5
toLoad = category;
if (toLoad == "home") {
if (currenty<20 && currenty>-20) {
loadMovie ("home.swf", "_root.content");
}
}
else if (toLoad == "biography") {
if (currenty<-321 && currenty>-361) {
loadMovie ("biography.swf", "_root.content");
}
}
else if (toLoad == "bookings") {
if (currenty<-662 && currenty>-702) {
loadMovie ("bookings.swf", "_root.content");
}
}
else if (toLoad == "contact") {
if (currenty<-1000 && currenty>-1043) {
loadMovie ("contact.swf", "_root.content");
}
}
else if (toLoad == "discography") {
if (currenty<-1344 && currenty>-1384) {
loadMovie ("discography.swf", "_root.content");
}
}
else if (toLoad == "journal") {
if (currenty<-1685 && currenty>-1725) {
loadMovie ("journal.swf", "_root.content");
}
}
else if (toLoad == "tracks") {
if (currenty<-2026 && currenty>-2066) {
loadMovie ("tracks.swf", "_root.content");
}
}
}

Problem: the function seems to be loading the wrong pages when it's called. It doesn't wait for the sliding clip to reach the desired _y position before loading the movies. When the sliding clip reaches the desired position, the movies that are loaded will disappear and there will be nothing loaded. It looks like the function is doing this when the sliding clip reaches the desired _y position for each possibility in the logic.

Do I need a for loop?

What's happening? I'm at my wit's end!!!!
__________________
I'm not impatient, I just have a low tolerance for boredom.

Reply With Quote
  #2  
Old December 31st, 2001, 02:00 PM
mbritton72 mbritton72 is offline
Shrill Digital God
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Raleigh, NC
Posts: 64 mbritton72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m
Reputation Power: 12
Solution

// This function detects the _y position
// of a movie clip, and loads a movie
// into a target. I call it with onClipEvents
// on the scrolling object

category = "home";
load = "";
function trigger (movieclip, category) {
currenty = Number(getProperty(movieclip, _y));
// home
if (currenty>-35 && currenty>=-15 && category == "home") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// biography
} else if (currenty<=-325 && currenty>-357 && category == "biography") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// bookings
} else if (currenty>-698 && currenty<-666 && category == "bookings") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// contact
} else if (currenty>-1039 && currenty<-1007 && category == "contact") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// discography
} else if (currenty>-1380 && currenty<-1348 && category == "discography") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// journal
} else if (currenty>-1725 && currenty<-1685 && category == "journal") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
// tracks
} else if (currenty>-2066 && currenty<-2026 && category == "tracks") {
if (load == "" || load != category) {
loadMovie (category+".swf", "_root.content");
load = category;
}
}
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > movie loads when _y is at a specific position?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap