Welcome, Guest. Please login or register.
Did you miss your activation email?
05/22/12, 17:02
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  General
| |-+  Flash MX 2004 (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Andresss, papachan)
| | |-+  LoadVars to load image data from database
0 Members and 3 Guests are viewing this topic. « previous next »
Pages: 1 [2] Print
Author Topic: LoadVars to load image data from database  (Read 3951 times)
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #15 on: 03/22/10, 02:42 »

are you aware of asynchronous execution?

If you load a movieclip, it is not there to be modified - you have to wait, until it is loaded and instantiated.

So you have to fetch the load event of that movie, before you can assign anything to it.

The same is for all dynamic loaded content.

Further important is:
If you load a component into a frame, and you move the framepointer, this component will lose its scope and will be reinitialized, when the frame pointer comes back.

So it is wise to assign components to single framed movieclips, and do all animation in separate clips.
Logged

happy flashing
Cool
Ronald
jhoward
Server what's that
*
Posts: 11


View Profile
« Reply #16 on: 03/22/10, 07:24 »

I appreciate your response. I a however still quite confused. While you are giving me good advice I cant understand enough to make script from it. When you say I need to "fetch the load event" it doesnt help me without code examples.

I also stopped using the loader component all together and am using the LoadMovie for my images instead, so I am not sure where you are going with that.

I am sure everything you are saying is accurate and wise, at this point I think (being a visual person) that I need code and then I can go back and determain "why"

Thanks,
J
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #17 on: 03/22/10, 10:20 »

suggestion: look into our loading and saving tutorials.
There you'll find the code you are looking for.
Just be aware, you are using AS2.
Logged

happy flashing
Cool
Ronald
jhoward
Server what's that
*
Posts: 11


View Profile
« Reply #18 on: 03/23/10, 13:51 »

Thanks for your ongoing help Ronald.

Ok, I started over using the exact example from this tutorial.
I also switched from asp.net to asp which has seemed to help.

In the theme of starting from scratch, this tutorial allows me to get back to where I was. I can load and display all of my variables, once!

I am left with the following.

I need the image that I am loading with Loadmovie to be a clickable hyperlink to an external website. *The hyperlink I want to use is also a variable "Link" that I am loading.

Secondly, I have these 3 layers. (actions, images, and text) with 1 frame each. Per the example, in the actions frame I am loading and dynamicaly namimg all of the variables to match the multiple object and text area instances  that I plan to display them in. 

my string coming in to flash:
Title0=title text here &SubTitle0=subtitle text here &Photo0=photo1.jpg &Link=http://www.website.com
&Title1=title text here &SubTitle1=subtitle text here &Photo1=photo2.jpg
&Link=http://www.website.com
&cant=2

How do I organize the frame timeline to play my first set of variables (Title0,SubTitle0,Photo0,etc.) to play for "say 50 frames" then to use the second set of variables (Title1,SubTitle1,Photo1,etc.) to play for the next 50 frames? and so on...

Code:
myData = new LoadVars()
myData.load("flash.asp")
myData.ref = this
myData.onLoad = function(succes){
if(succes){
for(var i=0; i<this.cant; i++){
this.ref["Title_txt"+i].htmlText = this["Title"+i]
this.ref["SubTitle_txt"+i].htmlText = this["SubTitle"+i]
this.ref["Link_txt"+i].htmlText = this["Link"+i]
this.ref["holder_mc"+i].loadMovie(this["Photo"+i])
}
}
else trace("Error loading data")
}
stop()

Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #19 on: 03/23/10, 15:51 »

Do not use frames to scan through your data.
At least not frames of the main movieclip Wink

If you have an animation, it should run in an extra movieclip. This could trigger a function at the main movie (with MX, you can call a function in the main movieclip with: _root.functionName(parameterName).

or, which is much better, use setInterval to call a function after elapsed time periode.

For further details on this, read the helpfile.

This is starting to become a little complex. You have to go step by step.

If you load the movie into the movieclip, you have to fetch the loaded event from the container clip, to findout, when your image or movie is loaded.
Then you can assign a eventhandler to the click event, to fire the getURL function.

This looks complicated, but after you understand the complet asynchrous operation and the event driven programming, you can do so many things, you never dreamed of.

But you must allways be aware - everything is asynchronous and event driven Wink
Logged

happy flashing
Cool
Ronald
jhoward
Server what's that
*
Posts: 11


View Profile
« Reply #20 on: 03/25/10, 11:38 »

do you know of any example files out there that would show me how to do something simliar to what I am doing?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6175


View Profile WWW Email
« Reply #21 on: 03/25/10, 14:23 »

Maybe this clears some things up for you:

http://www.flash-db.com/Tutorials/simplegallery/index.php?
Logged

happy flashing
Cool
Ronald
Pages: 1 [2] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything