Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have windows application which plays flash and images in certain intervals at the same location
here in the below code i am using the particular directory and particular file(like Top_1.swf and for image D:\.....)but i want like
i have to play flash or picture by finding their extension not by default giving their name.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Demo_Flash
{
    public partial class Form1 : Form
    {
        Timer timer1 = new Timer();
        Timer timer2 = new Timer();
        Timer timer3 = new Timer();

        int i = 0;
        int j = 0;
        public Form1()
        {
            InitializeComponent();
            i = 1;
            j = 1;
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Interval = (1000) * 10;
            timer1.Enabled = true;
            timer1.Start();

            timer2.Tick += new EventHandler(timer2_Tick);
            timer2.Interval = (1000) * 10;
            timer2.Enabled = false;
            
            timer3.Tick += new EventHandler(timer3_Tick);
            timer3.Interval = (1000) * 5;
            timer3.Enabled = true;
            timer3.Start();            
        }

        void timer1_Tick(object sender, EventArgs e)
        {
            pictureBox1.Visible = false;
            pictureBox1.Enabled = false;
            axShockwaveFlash1.Visible = true;
            axShockwaveFlash1.BringToFront();
  
            if (i == 1)
            {
                string path = System.Environment.CurrentDirectory;
                path += @"\Top_1.swf";
                axShockwaveFlash1.LoadMovie(0, path);
                axShockwaveFlash1.Play();
                i++;
            }
            else if (i == 2)
            {  
                string path = System.Environment.CurrentDirectory;
                path += @"\Top_2.swf";
                axShockwaveFlash1.LoadMovie(0, path);
                axShockwaveFlash1.Play();
                i--;
            }
 
        }

        void timer2_Tick(object sender, EventArgs e)
        {
            axShockwaveFlash1.Visible = false;
            pictureBox1.BringToFront();
            pictureBox1.Visible = true;
            pictureBox1.Enabled = true;
            
            if (j == 1)
            {        
                pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement1_1.jpg");
                j++;
            }
            else if (j == 2)
            {
               pictureBox1.Image = Image.FromFile("D:/Project Source/Experimented/Bulk Sms/ProjectSms/ProjectSms/bin/Debug/Advertisement2_1.jpg");
                j--;
            }
        }

        void timer3_Tick(object sender, EventArgs e)
        {
            timer3.Enabled = false;
            timer2.Enabled = true;
            timer2.Start();
        }
    }
}


any one know the answer please help me

[edit]Formatted within tags - tags do nothing with unformatted input![/edit]
Posted
Updated 14-Jul-10 2:12am
v3
Comments
OriginalGriff 14-Jul-10 4:19am    
So which part are you stuck on?
OriginalGriff 14-Jul-10 4:21am    
Oh, and the first thing you want to do is NOT do that in your Form Load event - set up a timer instead.
krishna_goluguri 14-Jul-10 8:29am    
plz see my code again i modified fully and added source also

1 solution

You said 'I have Windows application', then you say 'anyone know the answer'. I assume this means you WANT to have such an app. Checking extensions is trivial, look at the System.IO.Path class to find a method to get just an extension. There is no in build support for SWF files, unless Flash is installed and you use the web browser control, in which case there's no way to track how long the file goes for. Showing an image is trivial, obviously.
 
Share this answer
 
Comments
krishna_goluguri 14-Jul-10 8:28am    
see my code and reply again and if u cant understand plz ask me brief.dont give short answers or like(its deficult its trivial u have to work on that like that)
give me the exact answer or suggest me some way.withot installing flash how i ask

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900