Question

pass asp variable text to swf

Asked by: panhead802

Hello all,
I have an issue that should relatively simple however it is quite urgent. I have an asp classic page that has a variable:

uid = "test data"

what I really need to be able to do is embed a swf and have the text in the uid variable be displayed in a flash movie.

I am relatively comfortable with asp but not so much in actionscript. I have played in flash creating animations and navigation systems but nothing dynamic.

Please help
thanks
Panhead

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-09-07 at 06:33:31ID22813268
Tags

asp

,

variable

,

passing

,

actionscript

,

text

Topics

Hypertext Markup Language (HTML)

,

Adobe Flash

,

Active Server Pages (ASP)

Participating Experts
3
Points
500
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. swf to animated gif
    i have made a animation in flash and i give the publish format as gif with transparent and smooth settings and export it. The animated file is created but the resolutation is not same as the swf
  2. import swf in flash
    hiiiiii experts:), how can i import completely! .swf in flash.....for example i have an animation .swf but when i import it in flash not all the frames appear! is this a kind of protection !.... Helppppppp Mee:D Plzzzz ...
  3. swf and exe no resize
    Hi, I want to export my animation as a .exe and .swf. But I don't want the user to resize the final movie... Is there a trick to do it Thanks in advance
  4. In a container movie - load SWF - play to end - unload -…
    In Flash 8, using ActionScript 2.0 I would like to load an swf intro into a container movie - let it play to the end (how can I tell when the last frame is finished) and then unload it to purge the memory (as there are some large bitmaps and animation that won't play again) -...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: najhPosted on 2007-09-07 at 06:41:08ID: 19847554

There are a couple of solutions:
1. You can look into using the LoadVars class in flash. This can be used for reading the data in an asp page. This would be useful for having a background asp page (that you don't actually see) loading your data into flash.

2. You can look into using the PARAM tag when embedding your flash object within your web page. The param object can be used for reading in some specific data - and of course can be changed to what ever you want using ASP when you dynamically write the page.

 

by: panhead802Posted on 2007-09-07 at 07:50:50ID: 19848168

Alright, how would I go about using the LoadVars approach.
I am trying to create a flash document that displays a user name in the middle. I currently have it set up using simple ASP person logs in and gets brought to the page with the flash the asp calls te login info using a standard request.form and validates the login. What I want to have happen is a flash movie that appears in the login validation page that displays the user name.

Simple code for this page is:

<%

dim uid
uid = "Panhead"

%>



</head>

<body>
<%= uid %><br><br><br><hr>
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
<p align="left"></p>
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="550" height="400" id="get_var_test" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="get_var_test.swf?uid = <%= uid %>" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="get_var_test.swf?uid = <%= uid %>" quality="high" bgcolor="#ffffff" width="550" height="400" name="get_var_test" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

So I want the variable uid to show up in the swf.

Waht is the easiest way to have this happen?

 

by: najhPosted on 2007-09-07 at 08:36:24ID: 19848632

the easiest way to have this happen is not to use loadVars, but to use the <param> tag and flashVars in this case.

so get the param tag to be written as:
<param name="flashvars" value="uid=Panhead">


and in your flash file you wanna do something along the lines of...

if (_level0.uid == undefined) {
    // some code to run if the flash variable wasn't found

} else {
    trace(_level0.uid); // this will output the value to the output window
                                 // so you could use this in a text box too.
}

 

by: ProactivationPosted on 2007-09-07 at 08:50:41ID: 19848778

If you pass in a variable on the querystring, as you're doing in your code, the variable will be automatically created in the _root of your get_var_test movie. If you put:

trace(uid);

on the first frame of your test movie, you should find your value.

 

by: panhead802Posted on 2007-09-07 at 09:01:54ID: 19848861

Tried this and the text box returned _levle0.uid

 

by: najhPosted on 2007-09-07 at 09:06:28ID: 19848897

spot on, yep.

so the LoadVars method - well that's more useful if you've got a value you want to load in after your SWF has already loaded. And you can even use the LoadVars class for passing values to and from the database, but with some "proxy" asp pages in between. (so one receiving info from flash using the Request collection in asp and the other using response.write to write some name/value pairs like &variableName1=value1&variableName2=value2&variableName3=value3...)

 

by: najhPosted on 2007-09-07 at 09:08:26ID: 19848913

oh - did the trace work though? into the output box?

 

by: panhead802Posted on 2007-09-07 at 09:23:05ID: 19849041

ok, how do I get the value to the stage?

 

by: panhead802Posted on 2007-09-07 at 09:45:00ID: 19849202

I am getting confused. If I have the value in can I have it show up in the movie? If so and the variable in the string is uid what is the code to get it into the movie -- trace(uid); -- correct? Now if it is loaded I want to have it appear in the movie liek a responsew.write(uid)...do I need a dynamic text instance to load it up or an empty movie clip instance?

I think we are getting somewhere, just not too sure where. I can't believe this to be a difficult process...

 

by: najhPosted on 2007-09-07 at 11:01:45ID: 19849784

forgive me for not explaining - trace() is just used for debugging - and its use is slightly misplaced here given the context, so don't worry about that.

Lets say you have a dynamic textbox on stage called mytext_txt, you could pass it your variable by using the following actionscript on the main stage:

_root.mytext_txt.text = uid;

 

by: panhead802Posted on 2007-09-08 at 06:30:13ID: 19853281

Ok, so the _root.mytext_txt.text = uid; would get the text to a dynamic text box from the string if I have the link to the swf set up my_swf.swf?uid=<%= uid %> correct? now how about if I have an empty movie clip called my_clip and I want to insert a dynamic image into this page, normally I would us loadmovie("img1.jpg","my_clip") I want this to be a jpg relative to the uid so in the database I have the uid and my_logo fields I have in my uid logo1.jpg whne I log in I want to have the flash say Welcome uid and display logo1.jpg I have created the variable my_logo which contaians the path and logoname ie logos/logo1.jpg. Would I do something like this:
loadMovie("_root. my_logo;","my_clip")


Thanks for all of the help, I am definitely enjoying the learning process involed in actionscript it seems like a very cool language. Not alot different from Javascript just takes time to learn the syntax.

Thanks again!!

 

by: najhPosted on 2007-09-09 at 04:36:15ID: 19856456

yep - well you'd have the _root.mylogo bit as a variable so that you could change it


so loadMovie(myVariable, "my_clip");

and before that you declare it and then assign it - something like:
var myVariable:String = "_root." + databaseDerivedValue;

i'm not so sure about the thing you said about my_swf.swf?uid=<%uid %>
I don't tend to pass in variables like that - i tend to use params instead in the way i mentioned above, but it may well work. Try it and see. or it may be: my_swf?uid=<%uid %>

glad you're having fun - actionscript is a fun language - and as you say - it's quite like javascript..

 

by: Computer101Posted on 2007-11-08 at 15:11:46ID: 20246323

Forced accept.

Computer101
EE Admin

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...