Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Switching between plugin and flash

  1. #1
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Switching between plugin and flash

    so im switching back and forth between a flex app for making menus and a game using a plugin called panda3d. I biased the switching off a page on this site on switching content here. When i had both the plugin and the flex in as content in that example i was able to switch between them and the content would remain loaded. Yet for some reason when i wrote my own script for it(included below) when i switch back to the plugin it reloads... just trying to figure out how i keep it loaded so that somebody can pause the game and go back to the flex menu.

    HTML Code:
    <htm<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<script language="JavaScript" type="text/javascript">
    			function switchToGame()
    			{
         			document.getElementById("flexHolder").style.display="none";
         			document.getElementById("P3DHolder").style.display="inline";
    			}
    			function switchToFlex()
    			{
         			document.getElementById("P3DHolder").style.display="none";
         			document.getElementById("flexHolder").style.display="inline";
    			}
    		</script>
            <script src="RunPanda3D.js" language="javascript"></script>
        </head>
    	<body>
            <div id="P3DHolder"  class="omega13switch">
            	<script language="JavaScript" type="text/javascript">
            		function loadP3D(source)
    				{
    					P3D_RunContent('data', source, 'id', 'P3DFile', 'width', 680, 'height', 480, 'auto_start', '1');
    				}
    			</script>
            </div>
            <div id="flexHolder" class="omega13switch">
    			<iframe id="flexFrame"  
    				frameborder="0"  vspace="0"  hspace="0"  marginwidth="0"  
    				marginheight="0" width="680"  scrolling="no"  height="480"
    				src="Omega13Packager.html">
    			</iframe>
            </div>
    	</body>
    </html>

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Although it really isn't a Flash problem, the only thing I can see is that you aren't toggling, between the too as in the example script. Instead you are disabling and re-enabling, which is basically like doing a page refresh, everything will be loaded again.

    Instead of doing it that way, follow the JS in the switchcontent.js on the script page to see how it is toggled back and forth.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much for your response... and sorry i debated on where to put the thread....
    I'm not sure what you mean by toggling instead of enabling and dialing

    Here is what I was looking at in the switchcontent.js:
    HTML Code:
    ...
    	var innercontent=document.getElementById(header.id.replace("-title", ""))
    ...
    	innercontent.style.display="block"
    ...
    .... how is that code diffrent from my:
    HTML Code:
    document.getElementById("P3DHolder").style.display="none";
    Or am I looking at the wrong thing in the switchcontent doc?

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I am thinking it is more of a JavaScript thread post, but no matter.

    I am not a JS guy, so there isn't a whole lot I know about it. I try, but it doesn't always work

    I was looking at the toggle codes for the .js file from the example. There are 2 functions (probably more) that deal with showing and not showing the content:

    Code:
    switchcontent.prototype.sweepToggle=function(setting){ //PUBLIC: Expand/ contract all contents method. (Values: "contract"|"expand")
    	if (typeof this.headers!="undefined" && this.headers.length>0){ //if there are switch contents defined on the page
    		for (var i=0; i<this.headers.length; i++){
    			if (setting=="expand")
    				this.expandcontent(this.headers[i]) //expand each content
    			else if (setting=="contract")
    				this.contractcontent(this.headers[i]) //contract each content
    		}
    	}
    }
    
    
    switchcontent.prototype.defaultExpanded=function(){ //PUBLIC: Set contents that should be expanded by default when the page loads (ie: defaultExpanded(0,2,3)). Persistence if enabled overrides this setting.
    	var expandedindices=[] //Array to hold indices (position) of content to be expanded by default
    	//Loop through function arguments, and store each one within array
    	//Two test conditions: 1) End of Arguments array, or 2) If "collapsePrev" is enabled, only the first entered index (as only 1 content can be expanded at any time)
    	for (var i=0; (!this.collapsePrev && i<arguments.length) || (this.collapsePrev && i==0); i++)
    		expandedindices[expandedindices.length]=arguments[i]
    	this.expandedindices=expandedindices.join(",") //convert array into a string of the format: "0,2,3" for later parsing by script
    }
    Then there is also the persistence settings, and if enabled, is probably where the content stays loaded. I will see if we can track down a JS expert to look at this for you.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    That is ok im thankful for any help i can get... I read through those functions as well the code im talking about is the "switchcontent.prototype.contractcontent" function and the "switchcontent.prototype.expandcontent"

    The functions you referenced do toggle the content but they call the functions im talking about to do so... when it calls "this.expandcontent" and "this.contractcontent"
    HTML Code:
    switchcontent.prototype.sweepToggle=function(setting){ //PUBLIC: Expand/ contract all contents method. (Values: "contract"|"expand")
    	if (typeof this.headers!="undefined" && this.headers.length>0){ //if there are switch contents defined on the page
    		for (var i=0; i<this.headers.length; i++){
    			if (setting=="expand")
    				this.expandcontent(this.headers[i]) //expand each content
    			else if (setting=="contract")
    				this.contractcontent(this.headers[i]) //contract each content
    		}
    	}
    }
    Now you see my confusion on why it works in switchcontent.js but not in my code....

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Yes, but that is what I meant. Your code only hides or shows them, the JS file has many functions that go into the hiding and showing, not just a simple display or don't display.

    I have sent John a message and he should have more insight when he logs in.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    ok thank you very much

    edit: here is a link to the one using switchcontent.js

    and here is the one with my code

    they both include a bit flex app and then a demo app from Panda3D
    Last edited by corbo950; 04-23-2010 at 04:29 AM.

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,372
    Thanks
    77
    Thanked 3,421 Times in 3,382 Posts
    Blog Entries
    12

    Default

    I've looked at both versions. The Omega thing is empty, and the Flex thing doesn't seem to do anything. This is in both versions. I tried in IE, Opera and Firefox. Of the three, only Firefox even hints that it might need an additional plug in, but when I say OK, it can't find any.

    My advice would be though, if the one script works for you, use it.

    I have Flash 10 installed in all three browsers.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    The plugin wont show unless you have the plug installed ... you can find it here.. the flex is just a bit of test code of proof of concept... i tired to cut down the code as much as i could to the part i was actually talking about so it would be easier to sift through. The switchcontent.js script doesn't do exactly what i want. It is for the user to click and expand/contract content on a page...What i am trying to do switches between the flex and the plugin from inside the flex and the game to allow the flex to act as an "in-game menu". If it helps you to see what i am trying to do the actual plug-in so far is here
    I just need to figure out what im missing from the switchcontent.js that causes the plugin to be held instead of refreshed...

  10. #10
    Join Date
    Apr 2010
    Posts
    32
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I figured it out.... when i was using the switch JS i had the Plugin in an iframe.... dont ask me why but that makes all the diffrence

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •